Let’s say I have an empty gameobject with a ton of childed objects with images making up its graphics. Is there an easy way to disable rendering on a parent so it does the same for all of it’s children (like a .enabled equivalent for rendering)? Or am I forced to reference each image component in the children manually and individually enable/disable each one?
- You could just set the parent object to inactive
gameObject.SetActive(false);
** - If you are using UI objects and a Canvas then disabling the canvas will cause all children UI objects to not render
** - If you do need to disable renderers one by one you don’t need to reference each one, you can just do
foreach(Renderer r in GetComponentsInChildren<Renderer>()){r.enabled = false;}
**