- Home /
Disabling all renderers in a object
Hi
How would one be able to disable all renderers in a given object? Lets us say I want to disable a object, but that object is made out of several other objects, so only the object with a script attached(telling the renderer to shut of) will set the renderer to false and all the other renderes will still render.
I was thinking about a loop, returning all the renderers in a given object and then disabling them, but I am not sure if that is a efficient way of doing it or if there are any other solution(s) to my problem.
Answer by kevork · Nov 17, 2011 at 04:53 PM
Getting all the renderers once with Component.GetComponentsInChildren and iterating though the array to enable/disable the renderers is probably your best bet.
Ah, I had no idea that method even existed.
Thank you.
Your answer
![](https://koobas.hobune.stream/wayback/20220613045136im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
sync renderer.enabled or SetActive() over network? 0 Answers
renderer.enabled at random, how? 1 Answer
sync renderer.enabled or SetActive() over network? 2 Answers
Changing two different objects renderer colour 1 Answer
Enable fog from sccript 0 Answers