Animator state is reset when AnimationClips are replaced using an AnimatorControllerOverride

  • The state of the Animator gets reset when you change the AnimatorControllerClips at runtime.
  • When you try to change the AnimationClip, it does not work the second time that is changed.


It is expected that the Animator is reset when you change a clip. Unity needs to save the Animator state before replacing the AnimationClip and set it back after it has been replaced, but that feature is not implemented in some versions of Unity.


As a workaround you can use scripting to save and restore the state of the Animator when changing the AnimationClip.

void ChangeClip(AnimationClip clip ){
Animator anim = GetComponent<Animator>();  AnimatorOverrideController overrideController =
new AnimatorOverrideController();
AnimatorStateInfo[] layerInfo = new AnimatorStateInfo[anim.layerCount]; for (int i = 0; i < anim.layerCount; i++) { layerInfo[i] = anim.GetCurrentAnimatorStateInfo(i); } overrideController.runtimeAnimatorController = anim.runtimeAnimatorController; overrideController[currentClipName] = clip; anim.runtimeAnimatorController = overrideController; // Force an update anim.Update(0.0f); // Push back state for (int i = 0; i < anim.layerCount; i++) { anim.Play(layerInfo[i].nameHash, i, layerInfo[i].normalizedTime); } currentClipName =; }


More Information
Please also see this Forum post.
This article applies to Unity version 5.1.1f1
Was this article helpful?
1 out of 2 found this helpful
Have more questions? Submit a request


  • -1

    Minor Typo, but all good.

Please sign in to leave a comment.