- Home /
This question was
closed May 25, 2018 at 01:01 AM by
bpears for the following reason:
The question is answered, right answer was accepted
Question by
bpears · May 17, 2016 at 11:30 PM ·
c#componentsharedmaterial
Setting shared materials not working?
So, I try to assign material like
someObject.GetComponent<Renderer>().sharedMaterials[0] = coolMaterial
But it doesn't take. I've debugged it and the new material I am trying to assign it to is correct, and the object material remains the same after this line as before. It is an instanced clone, so I don't know if that has to do with it. I even tried .materials too.
Comment
Best Answer
Answer by bpears · May 18, 2016 at 01:02 AM
You can't assign each material individually: http://forum.unity3d.com/threads/material-sharedmaterial-sharedmaterials-confusion.4802/