- Home /
Unity 5 - enable/disable gameobjects or just renderer/colliders
It used to be that it was better performance to loop through and disable renderer/colliders instead of entire gameobjects. Is this still true for Unity 5?
Answer by hexagonius · Jan 23, 2016 at 10:54 PM
I think it depends on the amount of components. disabling just a lot of gameobjects with their transforms might be faster because there's no GetComponent involved which might have a bigger overhead in that case. But if there's a whole hierarchy involved behind gameobjects it's faster... you can't really tell. Try the one, if it's slow, try the other.
Answer by coolraiman · Jan 25, 2016 at 03:55 PM
to disable renderers, you have to loop all of them, even if you already kept reference of them
But, if all the things you want to disable can have 1 parent in hierarchy, disabling that parent will be much much faster
Your answer
![](https://koobas.hobune.stream/wayback/20220612061313im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Calling gameobject.transform vs. just calling transform directly - Performance negligible? 1 Answer
Detect 2D GameObjects when "Colliding" with each other without RB and collider. 1 Answer
Are .gameObject and .transform both using GetComponent() in the background? 1 Answer
What am I doing wrong? Mobile dev, low fps. 2 Answers
Is multiple canvases for non changing ui elements better for performance? 2 Answers