playMaker

Author Topic: Activate and Deactivate Gameobject  (Read 2010 times)

jrush64

  • Playmaker Newbie
  • *
  • Posts: 20
Activate and Deactivate Gameobject
« 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.

omgitstri

  • Playmaker Newbie
  • *
  • Posts: 46
    • My Prototypes
Re: Activate and Deactivate Gameobject
« Reply #1 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:
  • Set an array list with your 4 cubes
  • Press Space
  • Use Array List Activate Objects to deactivate all Objects
  • Array List Get Next
  • Activate the object you just got

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.
Tri Nguyen
Game Designer at Nvizzio Creations

omgitstri

  • Playmaker Newbie
  • *
  • Posts: 46
    • My Prototypes
Re: Activate and Deactivate Gameobject
« Reply #2 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
Tri Nguyen
Game Designer at Nvizzio Creations

jrush64

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Activate and Deactivate Gameobject
« Reply #3 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.