- Home /
Get All Renderers inside of GameObejct
Hello all –
I'm currently trying to figure out if there is a way to get all of the Renderers that are encompassed by a larger GameObject.
The game objects that have the renderers do not necessarily have colliders, which is why I'm fairly certain Capsule/SphereCast won't work, nor will triggers.
Other than parenting, is there any other way?
Thanks!
Do you mean 'encompassed by the mesh of a larger game object', or something else (like within a certain distance of the gameObject, or within the GO's bounding box)?
Probably not what you are looking for, but I thought I would mention it just in case. You can call Object.FindSceneObjectsOfType(typeof(Renderer)) to get a list of all the Renderer components in the scene. From there, you have access to the GameObject for each Renderer and can run any kind of test you want to deter$$anonymous$$e if the game object is "encompassed."