Find child of type/with component

I have a scene with many cameras (each has its own time where it’s enabled).
one of the cameras is a child to an object, and that object has a script called ‘EnterThis’

what i try to do is to perform a ‘Find’ search like FindChildOfType(camera) to get that child and not iterate between all the cams in the scene.
one option is to define the attribute as public and assign it from the inspector.
but is there a way to do this kind of search with code?

There are a couple of ways of doing this but I think the easiest would be to use the entity tags so you can use

thanks alot, ill test it out

however, will it also findByTag a disabled object?

you can get all children that have a camera from the root element with code let allElements = this.entity.findComponents(“camera”);

1 Like