how to add a material in unity 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;
}