private var rend : Transform;
function Start(){
rend = transform.Find("Bip01_Pelvis");
}
function Update(){
if(Input.GetKeyDown("1"))
{
var rendshad : Renderer = rend.GetComponent(Renderer);
rendshad.material.shader = Shader.Find("Particles/Additive");
}
}
Bip01_Pelvis has two Materials, I want to change them all or just second one.
There is actually a shader class defined, so you can store a reference to the shader in a variable. If you need to change shaders several times but then backtrack to whatever you were using previously, then a stack data structure might be what you need.