- Home /
Question by
Bentoon · Aug 17, 2014 at 11:57 PM ·
texturesvisibility
grouping Textures
Hello people I am turning the visibility of objects on and off with MeshRendering scripts in C#
Everything is good but sometimes I have a slew of things and would rather group them (dragging on top of each other hierarchy) in to trigger the visibility . However, the mesh renderer fails to work for parent child. How would you handle?
Thanks for your time
~be
Comment
Best Answer
Answer by Cherno · Aug 18, 2014 at 12:44 AM
MeshRenderer[] childrenRenderers;
childrenRenderers = gameObject.GetComponentsInChildren.<MeshRenderer>();
foreach (MeshRenderer rendererCurrent in childrenRenderers) {
if(rendererCurrent.gameObject != gameObject) {
rendererCurrent.enabled = false;
}
}
Thank you Cherno I actually am finding I have to do it manually for each grouping... partially because my organization is so primitive... & partially my design so irregular Thanks for your answer
be
Your answer