Welcome, Guest
Username: Password: Remember me

TOPIC: problem with InputField

problem with InputField 1 week 5 days ago #2598

Hi.

I want when i try to write my Arabic text into InputField in game mode, I2 Localization fix it to correct text. but when i use below code it don't work and only show one character in InputField.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using I2.Loc;

public class Input_feild : MonoBehaviour
{

	public InputField input;
	
	void OnGUI()
    {
        input.text = LocalizationManager.ApplyRTLfix(input[0].text);
    }

}

how can do it?

Thanks.
The administrator has disabled public write access.

problem with InputField 1 week 3 days ago #2602

I want know I2 Localization can fix InputField text during typing?
The administrator has disabled public write access.

problem with InputField 1 week 2 days ago #2604

  • Frank
  • Frank's Avatar
  • Offline
  • Administrator
  • Posts: 915
  • Thank you received: 196
  • Karma: 58
Hi,
Sorry for the delay in answering, this last days I have been traveling and unable to connect as often as I would have liked.
Unfortunately, the code to fix the InputFields is a bit more complicated:
- FixRTL can introduce/remove characters, so the cursor position needs to be adjusted accordingly.
- RTL is written from right to left, so the text needs to be reversed and cursor movement should be reversed as well.
- There is no callback in the InputField happening between the OnValueChanged and when the text is set in the TextComponent, (even the password masking happens in the same method), so the code needs to delay changing the text until after the InputField finishes updating its values.

I started doing some tests on making a component to fix InputFields when the current language is RTL. Will let you know as soon as its functional enough.

Hope that helps,
Frank
Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
The administrator has disabled public write access.

problem with InputField 1 week 2 days ago #2605

Hi.

Thanks for reply.

I found a free Persian package that can fix RTL text into InputField directly and work very well. :woohoo:

UPersian: Unity Game Engine RTL Support
The administrator has disabled public write access.
Time to create page: 0.129 seconds
Colors