Author Topic: NGUI CheckBox oddity  (Read 3576 times)

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
NGUI CheckBox oddity
« on: May 17, 2012, 02:04:25 AM »
Just been fiddling around with UICheckbox. I have my checkboxes and they click and then the bool parameters updates in the function I specified.
Everything as I expect, however when I come back to the menu later, the ticks are reset back to their defaults, therefore is it was true and then I set the value to false.
Next time I go back the variable is still false but the menu is back to true. So already they have become out of sync.

Maybe I am missing something simple, such as linking a variable that makes a connection so that it reads what value the variable is and updates when the menu appears.


--

By the way, embarrassingly I have only just discovered that you have a front end to your website and I discovered your documentation page.
http://www.tasharen.com/?page_id=197
and this
http://www.tasharen.com/ngui/docs/annotated.html

I can't believe I missed it after all this time.  :o
All I have only been using is a few online tutorials. I genuinely thought the forums were your entire site, since clicking home takes you to here and there are no other links to get back to the main area. Stupid me.

loopyllama

  • Guest
Re: NGUI CheckBox oddity
« Reply #1 on: May 17, 2012, 02:51:53 AM »
Quote
however when I come back to the menu later
if by later you mean in another scene, you need to keep track of the state yourself and set the checkbox to the value you are storing. The checkbox gives you a means to get what the user has set the state to, the rest is up to you.

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: NGUI CheckBox oddity
« Reply #2 on: May 17, 2012, 02:59:17 AM »
Well what I thought of doing was almost exactly that.
After creating the menu, updating the values of .isChecked with some separate bools. Just seems a bit odd to me that there is a bool in the button and elsewhere.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI CheckBox oddity
« Reply #3 on: May 17, 2012, 03:47:34 AM »
Look into UISavedOption. It will automatically save the state of your checkbox (or group of checkboxes) in player prefs.