change material in unity c# code example
Example: how to set material c unity
Renderer rend = GetComponent<Renderer>();
if (rend != null){
rend.material = newMaterialRef;
}
Renderer rend = GetComponent<Renderer>();
if (rend != null){
rend.material = newMaterialRef;
}