how to set material of object in unity in code 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;
}