playMaker

Author Topic: How to reach a pool of objects and activate/deactivate them?  (Read 949 times)

Neikke

  • Full Member
  • ***
  • Posts: 134
I have a pool of 10 objects (text prefabs) which I want to be able to activate one by one on each collision with Player.

So obviously I will have a pool of 10 instantiated at the start, but deactivated objects waiting to be activated on collision with player. But then how would I:

1. Activate them one by one without activating all 10 at once?

2. Activate only deactivated ones?

Please help!
« Last Edit: June 14, 2019, 06:10:45 AM by Neikke »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: How to reach a pool of objects and activate/deactivate them?
« Reply #1 on: June 14, 2019, 09:11:38 AM »
Hi.
use an Array, set size to 10 so you can drop in the objects.

drop in all the objects in element 0 place the 1st one that should be activated and in element 9 the last on (and rest in between)

You can loop by using 'array get next'.
Or you could use an int starting @ 0 and on hit get array (use the int on the index)
enable the object and do int add 1 to the int value.

or an action called Iterate.

here's a video about arrays :


Neikke

  • Full Member
  • ***
  • Posts: 134
Re: How to reach a pool of objects and activate/deactivate them?
« Reply #2 on: June 14, 2019, 11:39:45 AM »
OK, thanks a lot man!