2D Toolkit Forum

2D Toolkit => Support => Topic started by: Julian RebelDwarf on October 16, 2013, 02:45:02 pm

Title: Set input string from code
Post by: Julian RebelDwarf on October 16, 2013, 02:45:02 pm
Hi, i'm trying to set a text in an input.

It's a build/editor menu, so when i create a new army i set the name and everything works great, but the problem is when i tried to edit. In my code i have:
Code: [Select]
textInputBuilYourArmy.Text = data.name;
The textMesh InputText show the correct string, but it never change from the EmptyDisplayText and i can't find a function to do that
Title: Re: Set input string from code
Post by: unikronsoftware on October 17, 2013, 01:28:19 am
Is the textinput selected when you do this? Looking at the code, that is the only situation it doesn't update the object state. Also, are you setting active, etc around here?
Title: Re: Set input string from code
Post by: Julian RebelDwarf on October 17, 2013, 01:25:52 pm
The textInput is active, but his parent isn't when i set the text.

I changed the order, so first active the parent and then run the script and add SetFocus();

Now it's working. Thanks..