playMaker

Author Topic: multiple toggles  (Read 1859 times)

krane

  • Junior Playmaker
  • **
  • Posts: 63
multiple toggles
« 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).

« Last Edit: February 11, 2017, 10:31:04 AM by krane »

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
Re: multiple toggles
« Reply #1 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.

marv

  • Junior Playmaker
  • **
  • Posts: 50
Re: multiple toggles
« Reply #2 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

krane

  • Junior Playmaker
  • **
  • Posts: 63
Re: multiple toggles
« Reply #3 on: February 06, 2017, 08:28:50 AM »
Thanks, Toggle Group is what I need!