I’m having trouble getting it to work…
This is what I tried, but it doesn’t change anything. (smr = the SkinnedMeshRenderer on my model)
Material mat = (Material)Resources.Load ("Materials/SomeMaterial");
smr.materials[0] = mat;
Is it possible that changing the material dynamically doesn’t change the texture that is assigned to the material on the SkinnedMeshRenderer? Do I need to change both?
EDIT:
Found this which is a little helpful, but I only want to change 1 material on a long list, not all of them. I really don’t want to reference each material for each part and reassign them all at once.
Nevermind, I got it working. I just assigned all the materials to a new array, swapped out the one I wanted, and then reassigned the array. Kind of dumb that it has to be done this way though…
Material[] mats = smr.materials;
Material mat = (Material)Resources.Load ("Materials/SomeMaterial")
mats[0] = mat;
smr.materials = mats;