Author Topic: About UIToggle group,i meet a problem..  (Read 3492 times)

woshihuo12

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
About UIToggle group,i meet a problem..
« on: June 27, 2014, 07:45:13 AM »
i create 3 uitoggle item.in editor they are all seted "Starting state" to false..and they all are group 1.
and i registed the changed callback function like this...

public void OnIconCheckChanged()
    {
        Debug.Log("Toggle: " + UIToggle.current.name + " has state of " + UIToggle.current.value);
    }

and i want set the first item checked,so i change the first item's value to true in my script,
at beginning, the first item checed, when i click the first checked item, the log shows "item0 has state of false" while not show "item0 has state of true"?? why?
« Last Edit: June 27, 2014, 07:54:37 AM by woshihuo12 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: About UIToggle group,i meet a problem..
« Reply #1 on: June 27, 2014, 01:38:43 PM »
Toggles in a group shouldn't be set to 'false'. Instead set one of them to 'true'. It will set others to 'false' automatically. You can never un-toggle the last toggle, unless "State of None" is checked on all of them.