Author Topic: Get all components or scripts  (Read 392 times)


  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Get all components or scripts
« on: March 14, 2020, 06:45:31 AM »

I'm looking for the way to get all the components or scripts of the same type in a scene.

For example, i have a script called "Outline" and i need to find and store all of this scripts in the whole scene, for all the game objects in it.

Is it posible?



  • Sr. Member
  • ****
  • Posts: 454
    • View Profile
Re: Get all components or scripts
« Reply #1 on: March 14, 2020, 10:48:39 AM »
That looks like an expensive procedure. You could loop over all objects in the hierarchy, then check the with get component if it’s present and store the result in an array. My tip would be checking out array actions, and get component.

You could also do this the other way, have each game object with said component register itself with an FSM.


  • Administrator
  • Hero Member
  • *****
  • Posts: 5187
    • View Profile
    • jinxtergames
Re: Get all components or scripts
« Reply #2 on: March 15, 2020, 12:59:48 AM »
you should indeed do this at the start of your scene and not somewhere in between.

Also you might want to look into Array Maker as its more advanced than the included Array's

With array list you could use 'Array List Get All Child Of Game Object'
then loop thru them with 'Array List Get Next' and check with 'Has Component'
then store in a different array.