[SOLVED] Animations Only Playing After Enabling the Animator in the Editor

Good day. I have implemented a system wherein a pet model is assembled through script. One of the child objects is the animator with an assigned Animator Controller. I’m having a problem playing the animation at the start of the game. The animator is in the right animation state but the animation clip is not playing. However, if I disable and then enable the Animator component in the Editor, the animations will play as expected. Please see my recorded run below:

As you can see, I also tried enabling the animator component via script but it didn’t work as well. Any suggestions on how to fix this? Thank you very much.

I figured out a workaround for this problem. I refreshed the animator using Rebind and Update after the model has been assembled.

this.petAnimator.Rebind();
this.petAnimator.Update(0f);
3 Likes

I had this exact same issue. Tried the workaround and it worked perfectly!

1 Like

I had this exact issue and the Rebind + Update(0f) trick solved this issue. Thank you so much ironfiftynine.

Is this a Unity bug?

I think it has something to do with how the animator works. I’m not sure how your models and rigs are structured but in my case, given that I updated the child objects and rigs of my character at runtime, I need a way to update the references of the animator as needed and my posted solution does that.

1 Like