Forum rules - please read before posting.

Change State of the Toggle with a different button.

As per my other thread, I have a set of toggles that turn on and off various GUI's.

Each of the toggle has a bunch of Actions that turn on and off various GUI's.
Toggle 1 = turns on GUI A, turns off GUI B and C
Toggle 2 = turns on GUI B, turns off other GUI's
Toggle 3 = turns on GUI C, turns off other GUI's

Because these are in a Toggle group, when one toggle is selected, it not only turns on/off GUI's, but the toggle also gets highlighted, turning off other toggles.

Now, the problem is that I want to be able to turn off (let's say) GUI A via a different button, while it's active - essentially GUI A has an additional "X" button to turn it off. That "X" button has ActionList to turn off the GUI A, but that results in Toggle 1 remaining selected.

I don't see any ways to detect if a toggle is on or off, which would allow my "X" button to close the GUI and also deselect the Toggle. Is there anything that I'm missing or should I rely on a custom script to do this?

Comments

  • If GUI A is a separate menu, you could just check it's visibility with Menu: Check state.

    To determine if a Toggle is on, read it's isOn property. This can either by the isOn property of Unity's own Toggle component, or AC's Toggle element:

    (AC.PlayerMenus.GetElementWithName ("MyMenu", "MyToggle") as MenuToggle).isOn
    
  • Thanks for the tips! I was able to create a script that switches toggles off!
    I've used it on Unity's OnClick function.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.