Hi , I have a gameobject that have 5 materials with diffuse shaders. I want to changing the shaders of all from diffuse to Trasparent/Diffuse. By bellow code i can only change one shader. how can i access all shaders and change them? maybe with using an array.
var shader1 : Shader;
var shader2 : Shader;
function Start(){
shader1 = Shader.Find( "Diffuse" );
shader2 = Shader.Find( "Transparent/Diffuse" );
}
function Update() {
if (Input.GetKeyDown("f")) {
if( renderer.material.shader == shader1 )
renderer.material.shader = shader2;
}
}