Author Topic: checkbox starting unchecked  (Read 4351 times)

loopyllama

  • Guest
checkbox starting unchecked
« on: April 17, 2012, 11:14:00 AM »
I have a checkbox that I wish to start unchecked. I achieve this but I always see the checkbox in the gui checked, then I see it disappear. In my game, the player sees this when they load a new level and hit pause. My menu pops up and the checkbox gets checked for a split second, then turns off.

What is the best way to get a checkbox to not appear on for a splt second?
Example: place a check box in unity, turn off "starts checked", hit play. Notice the check box appears checked, then turns off. I wish for the user to not see it ever checked if it is indeed in the "off" state.

loopyllama

  • Guest
Re: checkbox starting unchecked
« Reply #1 on: April 17, 2012, 01:25:03 PM »
I have found a working solution. It appears if I set the button to isChecked = false in Awake () then the menu will appear unchecked at the start. It looks like the code has a special case: if you call isChecked before awake it will directly set the alpha of the check mark to the state you pass it.

joreldraw

  • Guest
Re: checkbox starting unchecked
« Reply #2 on: April 17, 2012, 04:49:50 PM »
This is a solution if ever you need to start unchecked.
I use playerpref to store status with a bol and when i start my app i check and set status stored with uichecbox.ischecked

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: checkbox starting unchecked
« Reply #3 on: April 17, 2012, 06:25:09 PM »
Btw, UISavedOption script can be used to automatically store the state of the checkbox in PlayerPrefs (or a group of radio buttons made out of checkboxes).

mmuller

  • Guest
Re: checkbox starting unchecked
« Reply #4 on: September 09, 2012, 02:54:08 PM »
ArenMook,

Just to confirm, where should the UISavedOption be placed for a radio set? On each individual checkbox or the Radio Root?

Regards,

mm

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: checkbox starting unchecked
« Reply #5 on: September 09, 2012, 05:23:16 PM »
Depends on what you have. If you have a group of checkboxes set up in a radio button group, then the radio root. Otherwise, individual checkboxes.