Author Topic: Bug report in Toggle Set().  (Read 1736 times)

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Bug report in Toggle Set().
« on: June 12, 2014, 12:56:00 AM »
I lost a some time trying to figure out why the toggle wasn't being a set in code.

if (group == 0 || value || optionCanBeNone || !mStarted)

My situation is :

group = 5
value = false
optionCanBeNone = false
mStarted = true



ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bug report in Toggle Set().
« Reply #1 on: June 12, 2014, 02:33:35 AM »
The way it is now is intentional. When in a group, you should not be setting toggles to 'false' state. You should instead be setting a single toggle to 'true' state, and it will take care of setting other toggles to 'false' automatically.

When "option can be none" is off, you can't turn off the active toggle. One toggle must always be active in a group.

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: Bug report in Toggle Set().
« Reply #2 on: June 12, 2014, 01:30:20 PM »
I need to set this to false to get around the bug in the Accordion nested scrollView problem.   

The problem is that NGUI BetterList only works for enabled children, so when one of the child toggle is not active, it will not change the state of that child. 

This is what happens when the accordion header is collapsed, the child inside is not visible to the BetterList.  If you could fix the bug then I will not need to set the toggle to false.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bug report in Toggle Set().
« Reply #3 on: June 13, 2014, 03:55:01 AM »
That's not a bug. When a game object is disabled, it effectively doesn't exist as a part of the scene. It wouldn't make sense to keep references to scripts on disabled objects. As I mentioned in the other thread, you need to use unique groups instead of having all your toggles share the same group ID.