Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: krane on February 05, 2017, 01:10:42 PM

Title: multiple toggles
Post by: krane on February 05, 2017, 01:10:42 PM
I have a scene with 6 toggles. If one toggle is on, all others should be turned off.
I can't seem to get this to work. Attaching screenshot. Basically, Ugui proxies on all toggles, ugui prefab in scene. 

Each toggle is set to off at start with global bool value (t1, t2, t3, etc.).

When toggle is clicked, it tests the bool and if it's off, turns it on, and then checks and turns all others off if they are on (with bool tests).

Title: Re: multiple toggles
Post by: elusiven on February 05, 2017, 02:32:56 PM
Are all those toggles children of one parent object? If yes, instead of listing all of them in one FSM, you can use a get next child action, (foreach loop) and disable all toggles except the one that was changed.
Title: Re: multiple toggles
Post by: marv on February 06, 2017, 06:48:22 AM
This can be achieved even easier if you attach a toggle group script to the toggles' parent object and set it accordingly in the individual toggle scripts. I stumbled over this a while ago and it made life quite a bit easier in that regard.^^

cheers
Title: Re: multiple toggles
Post by: krane on February 06, 2017, 08:28:50 AM
Thanks, Toggle Group is what I need!