- Home /
How can i change the color of my Mesh Renderer, after Color Animation.
So I'm trying to change the color of my GameObject in Update() every couple of seconds via Script, which works fine and everything.
Now I am playing an animation animating color changes and afterwards, if I try to change the color again in the regular interval, it won't accept the new color, despite the new color being displayed in the editor like this:
The color should be red, but is actually blue in the game.
I have tried:
Using the Legacy Animation system with Play(anim);
Using the Animator Controller and triggering the animation via SetTrigger(), and in the End: ResetTrigger();
Disabling the animation property after the animation is done.
Changing the shader of the object (Its no shader problem)
Setting the Wrap Mode of the Animation to once.
Adding an Animation Event at the end of my animation, setting the color to a different value.
Putting the code in LateUpdate() (some Dev said, then I could overrule the animation from script (even tho the animator is not enabled, but I just thought i should give it a try)
It must have something to do with the Animation never finishing, because the Object always remains the last animated keyframe color, and the animation cant start again, however if I use the animator, the animation state clearly finishes.
EDIT: I know now that the problem is that you have to use a shared$$anonymous$$aterial if you edit it from multiple places at the same time, else unity creates instances of the same material, but in the unity animation editor, you cant animate shared material.
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Animate Script Properties with Animator 1 Answer
Bug? Adding properties disabled for every animation except first 0 Answers
Using the animator to animate position? 1 Answer
Multiple Animation Controllers 1 Answer