Hello Guest

Author Topic: TextInput bug?  (Read 3293 times)

test84

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
TextInput bug?
« on: January 27, 2014, 02:15:18 pm »
Hi,

I put 11 TextInputs next to each other not using layouts or anything with 11 TextMeshes, and a button. Upon the load, in Awake, I set some values in those TextInputs via their Text property.

Problem is, some of TextInputs are acting strange and do not show the value in them and do not show anything at all. If you click/touch those, it shows the text input indicator and if you press left on keyboard, the number suddenly pops up.

You can download the scene here: https://www.dropbox.com/s/alrd05lufi0ybgd/tk2dbug.unitypackage
(I didn't include any tk2D code inside it)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: TextInput bug?
« Reply #1 on: January 27, 2014, 03:02:12 pm »
Could you register your copy (http://2dtoolkit.com/forum/index.php?index.php/topic,34.0.html) and post the scene to the private support forum? It could very well be something to do with how the scene is set up.

test84

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: TextInput bug?
« Reply #2 on: January 27, 2014, 03:10:00 pm »
Thanks for the quick reply. I've got the project, tk2d along with other assets from a client and doing work over it so I can't register. I thought exporting my scene would work as it has code that I used to set up my scene in it.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: TextInput bug?
« Reply #3 on: January 27, 2014, 03:21:59 pm »
It should, but the file you sent me only has the script and nothing else.

test84

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: TextInput bug?
« Reply #4 on: January 27, 2014, 03:43:19 pm »
Thanks, I attached another export to this post. I would appreciate it if you could take a look at it.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: TextInput bug?
« Reply #5 on: January 27, 2014, 04:04:11 pm »
it is indeed a bug, which I think is caused by unity deserialisation. As there is no specific execution order, your awake function seems to be called at a random point where the text input is set, but before its awake is called. That is fine, and the code deals with it, except this seems to be calling awake before the text mesh game object is awakened. Basically the text mesh containing "0" is set to visible, but then gets turned off by the scene loader, which puts the textInput in an indeterminate state.

Easy fix - move your function from Awake to Start.

test84

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: TextInput bug?
« Reply #6 on: January 27, 2014, 04:07:01 pm »
Thanks man, you are a life saver.