Can't Change Material On GameObject with Animator During Runtime.

For some reason I can’t change the Materials on my spriteRenderer during runtime via script. I did some testing and this only happens on the gameobjects with an Animator. If I turn the animator off during runtime then I can change it just fine, and turning the animator back on will keep the material. I can’t even change the material through the inspector during runtime with the animator on. I can however, change the material, if I change it using animation clip timeline. Anyone know whats going on that is stopping me from changing the material freely?

Animations always win. Doublecheck that nothing in the animation is manipulating anything to do with the Renderer, anywhere anytime in its timeline.

EDIT: just for curiosity I checked… it certainly does work as advertised. Run enclosed scene.

7476353–919211–ChangeAnimatedMaterial.unitypackage (42.5 KB)

The animation State only manipulates 2 bones and nothing else.

Weird. Try add a fresh “testing” sprite on one of the bones, see if you can modify that sprite’s material.

I also just tested that the same holds true for sprite renderers. Attached.

7476392–919217–ChangeAnimatedMaterial2.unitypackage (77.2 KB)