playMaker

Author Topic: send event to multiple game objects? [SOLVED]  (Read 2546 times)

Splankton

  • Sr. Member
  • ****
  • Posts: 268
send event to multiple game objects? [SOLVED]
« on: October 06, 2013, 01:03:44 PM »
Hi, if I have more than 2 game objects using the same tag, say "enemy" how can I send an event to every game object with the tag "enemy"?
I know there is broadcast event, but it doesn't use tags. Is there another way of doing this?
« Last Edit: October 07, 2013, 03:09:26 AM by jeanfabre »

Bjakuja

  • Junior Playmaker
  • **
  • Posts: 75
Re: send event to multiple game objects?
« Reply #1 on: October 06, 2013, 04:12:56 PM »
Hi!
There are many ways you can do this, here are some options:
For example you can create empty game object and parent all enemies to that object, then use Send Event action and check children if you want to send to them.
Other option can be to Broadcast All and to send event to every FSM object on the scene.  ;)

There is more complicated way of doing this with Array List where you can use Array List Find Game Object By tag, and then you can use Array List Get Next,  and loop through items by storing them as game objects and send event to every item until you send event to all objects.
I hope this can help ;)
Cheers!
« Last Edit: October 06, 2013, 04:15:50 PM by Bjakuja »

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: send event to multiple game objects?
« Reply #2 on: October 06, 2013, 04:16:19 PM »
Excellent, the 1st option is best. Thanks for you help!

Bjakuja

  • Junior Playmaker
  • **
  • Posts: 75
Re: send event to multiple game objects?
« Reply #3 on: October 06, 2013, 04:21:20 PM »
No problem, I am glad I could help ;)