Hello Guest

Author Topic: Set input string from code  (Read 3617 times)

Julian RebelDwarf

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
  • Mobile developer
    • View Profile
    • Rebel Dwarf
Set input string from code
« 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

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Set input string from code
« Reply #1 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?

Julian RebelDwarf

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
  • Mobile developer
    • View Profile
    • Rebel Dwarf
Re: Set input string from code
« Reply #2 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..