Does Animator-Animation overrides/disables script changes?


I encountered following problem.

I instantiate an object from prefab and default rotation is set to it in script. If I add an animator+animation that affects rotation - I can no longer change rotation from script.

Is it normal? Or a bug? Or I’m doing smth wrong?

I included [|59499] to see what I mean.

Those are same objects with a script that rotates them 30 grad on start.

Red rect has animator + animation that affects rotation.

Green rect has the same animator turned off.

Short Answer: Yes.

Long Answer: Basically. Because the animation is changing it every frame the animation is running. If you have it set in one animation it will look for it in all your animations, even if it isn’t set during that animation. If not set it will stay at default, or where it was. Your script is likely working correctly, but your animation is just going and changing it back.

Both are doing their job, but Animation comes after Start() or Update()
You can use LateUpdate() to change things after Animation has updated, and likely fix your problem.