Uncheck Toggle in code

Hi !

So my question is simple, I know how to simulate a “click” on a Toggle with :

toggle.isOn = true;

However, “toggle.isOn = false;” does nothing, I think it does change the state but doesn’t change the graphic. I could hack my way into this I guess and change directly the background image of the tick, but is there a better way ?

Thanks !

Edit : Actually, it doesn’t seems to change the value to “False” either.

Thanks for your advices ! They got me to think a little “outside the box” and I found the issue : I should have precised that I’m using a “ToggleGroup”, and, by default, the ToggleGroup element has a “Allow Switch off” checkbox set to “false”. Now that it is set to true, everything’s fine !

yes, you can use the toggle.isOn = true; but if you have toggle Group than you can use.,

Gameobject.GetComponent().SetAllTogglesOff()

to set all off or on.