Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: jrush64 on December 20, 2017, 04:17:23 PM

Title: Activate and Deactivate Gameobject
Post by: jrush64 on December 20, 2017, 04:17:23 PM
Hi,

I have a question I have a list of gameobjects like cube 1, cube 2, cube 3, cube 4 all deactivated. When you press a button, i want to be able to activate cube 1 only, then when you press the same button, deactivate cube 1 and activate cube 2; and so on.

How would I go about doing that because I have no idea.

what I have so far is, I was able to add all the objects to an array then loop them to activate cube 1 only and so forth. The issue is, it doesn't deactivate the others. I would really appreciate the help.
Title: Re: Activate and Deactivate Gameobject
Post by: omgitstri on December 20, 2017, 04:29:03 PM
Hello,

There are multiple ways, I think a simple way is to use "Array List Activate Objects"
Here's what the state would look like if I set it up using it:

I'm sure there are more optimized way to do it but this is what I can think of off the top of my head right now.
Title: Re: Activate and Deactivate Gameobject
Post by: omgitstri on December 20, 2017, 04:33:46 PM
Here's a cheaper solution

Have an input manager which Send Even By Name to the FSM that activate/deactivate your objects

Make sure the Reset on Exit is checked
Title: Re: Activate and Deactivate Gameobject
Post by: jrush64 on December 20, 2017, 05:46:18 PM
Here's a cheaper solution

Have an input manager which Send Even By Name to the FSM that activate/deactivate your objects

Make sure the Reset on Exit is checked

Thank you. I was able to get it to work with your first suggestion.

I'd rather use to get all the cubes or gameobjects by tag that  I need to activate and deactivate because I might use more than 4 cubes.

There's a small glitch. It activates and deactivates the first gameobject twice before moving on to the next gameobject.