I have a fairly simple question: I am trying to change an object's material via code with the line
rend.material = NewMat;
rend is of type
MeshRenderer to be specific) and
NewMat is of type
Material. Both variables are public and assigned in the inspector and both are not null.
When I now try to assign the material, nothing happens. I don't event get any error. When I look into the inspector I can see that under Materials on my MeshRenderer the material doesn't even change. The line
Debug.Log(rend.material == NewMat);
What am I doing wrong?