playMaker

Author Topic: Get all objects in scene with a tag and store in array.[SOLVED]  (Read 3659 times)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Get all objects in scene with a tag and store in array.[SOLVED]
« on: February 13, 2017, 04:33:01 AM »
If there is not currently a way to do this, it would be super helpful.
« Last Edit: February 27, 2017, 02:23:18 AM by jeanfabre »

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Get all objects in scene with a tag and store in array.
« Reply #1 on: February 13, 2017, 05:21:13 AM »
I sorted it out by adding an FSM to each object which adds an object to array OnVisible, and removes it on OnBecameInvisible.

If you want to put all objects in scene to array, visible or not, just add them to array on level loaded, iterate the array and remove objects that don't match the wanted tag.
Available for Playmaker work

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
Re: Get all objects in scene with a tag and store in array.
« Reply #2 on: February 13, 2017, 06:14:39 AM »
It won't be very efficient though if you have a lot of objects and you add an FSM to each one, you lose performance every time you add an FSM to a gameobject.

Let me know if you still want this action

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Get all objects in scene with a tag and store in array.
« Reply #3 on: February 14, 2017, 02:52:05 AM »
Hi,

 I have just done it, it's on the Ecosystem.

https://twitter.com/JeanAtPlayMaker/status/831409530043060224

 Bye,

 Jean

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: Get all objects in scene with a tag and store in array.
« Reply #4 on: February 24, 2017, 08:10:58 PM »
That is fantastic. Keep kicking ass, guys.