Hi there,
In an OnClick-Function of a GameObject I want to change the material of an object. The material is residing in my Resources folder. Using
Material mat = Resources.Load("SR_Material/Building/SR_Building1_Ghost", typeof(Material)) as Material;
renderer.material=mat;
doesn’t work. Just changing e.g. the materials color works just fine, but I don’t know how to exchange the entire material at once. I also tried copying an existing material of another GameObject without success. Also having a public material on my script and use that one didn’t work either, so I guess I am doing something fundamentally wrong by just assigning “renderer.material=mat”?
Is there anything special I have to do when assigning materials at runtime?
Thanks for the help …