Author Topic: UIInput Woes  (Read 2374 times)

KeithT

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 55
    • View Profile
UIInput Woes
« on: April 26, 2013, 04:59:07 AM »
Having trouble getting UIInput to work as desired, when integrating it with other code. So have gone back to basics with an example but still have issues: Setup included below.

Several problems.

1. Other code moves the position of the label referenced in UIInput during the game, but when it is edited the current position of the label is not used, the very original position when the game started/UIInput ran. NGUI seems to be caching position for some reason. Is this on purpose ?
2. Is "Use Label Text at Start" supposed to leave the text in the label available for editing (what we want) ? Have played with the example scene 2.5.1, having it selected or not makes no difference to the behaviour. ?
3. Does Start in "Use Label Text as Start" really mean when Unity's Start runs, so if you change the label value and then try and edit it, you get the very original value ?
4. In the final implementation we need the label to display things as the game plays and then allow the user to edit some label content after they press a button to turn editing on. Have tried disabling/enabling the GO and the UIInput script as a method of doing this, again with odd results. Does anyone have a working approach for this ?
« Last Edit: April 26, 2013, 05:31:47 AM by KeithT »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIInput Woes
« Reply #1 on: April 26, 2013, 01:17:30 PM »
#2 is a bug. I fixed it locally. You can fix it by changing line 241 from:
  1. mText = (label.text == mDefaultText) ? "" : label.text;
to
  1. mText = (label.text == mDefaultText && !useLabelTextAtStart) ? "" : label.text;

I don't understand what you're trying to do in #1. Why are you moving a label? If you're going to move something, move a parent object, and make sure there is no other conflicting script there, such as UIButtonOffset.

For #4 you likely want to edit the 'defaultText' property.

KeithT

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 55
    • View Profile
Re: UIInput Woes
« Reply #2 on: April 27, 2013, 11:27:44 AM »
Thanks for responding, had implemented a fix for the bug, but guess this will be in an upcoming release.

Re #1. Think something else must be referencing it, as removed the cache on the position and got the same issue, so think is us.

Re#4. Got this working by adding and removing UIInputs.