I try to change all shaders in a hierarchy:
private var shader2 = Shader.Find( “Transparent/Diffuse” );
function Update () {
All_Objects_in_Hierarchy.renderer.material.shader = shader2;
}
What must be there instead of “All_Objects_in_Hierarchy” ?
I am sure tis is simple, but i have no idea…
Thanks for Help!
You’d have to do it in a loop. Something like:
var allRenderers = GetComponentsInChildren(Renderer);
for (r=0;r<allRenderers.length;r++) {
allRenderers[r].material.shader = shader2;
}
Thank you, but this gives me an error message…
but the the loop is the thing i needed to know!
I used now:
for (var xyz : Renderer in allRenderers)
…instead and it works well.