how to change materials in unity code example
Example 1: how to set material c unity
Renderer rend = GetComponent<Renderer>();
if (rend != null){
rend.material = newMaterialRef;
}
Example 2: how to change material in script unity
public Material Material1;
//in the editor this is what you would set as the object you wan't to change
public Renderer Object;
void Start()
{
Object.material = Material1;
}