Can't change transform rotation of GO with an animation that change it's rotation

Hi all,
I have a GameObject with an animator that has two state:

  • Idle: a state without animation that is my default state
  • TestRotation: a state with an animation that rotate the GO on Y axis.

The problem is that when the animator is in the Idle state I can’t change the transform rotation, neither from script, neither from inspector. It seems that Unity locks the rotation of the object if there is an animaton in the animator that has the rotation property.

If i remove the rotation animation from the rotation state, the rotation of the GO is unlocked.

Is there a workaround to solve this problem? Considering that in my project i can’t put the GO in an empty GO to manage it’s rotation from the parent.

Thanks for your help,
Simone

Ok, I came accros this same problem and got a good enough solution, once Im done with the animations I disable the animator component with( animator.enabled = false; )

In my case I disable the animator in the last frame of the animation and it leaded to some flickering after enabling it back (the last frame of the last animation would play), so I had to use lateupdate in the first frame after enabling the animator to “override” the animator.

Im not a coder - but I think this can be accomplished by rotating the model in late update, - this happens after the animation has been processed. But I’m only guessing - and I think this is not advised.

Check Unitys processing stack - where they list what is processed first - last. I know things can be performed after the animation step, where the animation is processed.

You could also just parent your object to an empty object and move that instead