playMaker

Author Topic: find next game object in scene with a certain name?  (Read 1831 times)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
find next game object in scene with a certain name?
« on: July 29, 2016, 01:58:53 AM »
at the start of a level, I want an fsm to find each "quest progression flag" object, then do whatever is inside its fsm. after it does one fsm, we need to move to the next "quest progression flag" object, and execute its fsm.

I want it to keep doing this one by one, and only stop when the name of that "quest progression flag"'s parent object repeats, signaling the list is over.

like "find next child" but for objects with names in a scene. how do we do that?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: find next game object in scene with a certain name?
« Reply #1 on: March 13, 2017, 02:12:27 AM »
Hi,

for this you should use tags to improve performances, as Unity search system by name within a scene is not optimal.

 then, your flags are likely, hopefully organized already with each of your flags sharing a common parent, do the find using "Get Next child" within this parent.

What I would do is run this routine once when the scene starts and save each of these flags inside an array. Once you have all your flags in the array, you can delete them or maintain in index of the current pending flag or another array of the same lengths with information about each flag ( for example a bool, to know if that flag at index i was taken or not).

 Bye,

 Jean
 Bye,

 Jean