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.