EDIT : The issue was not linked to Animator Override Controller but instead on the culling of the character models.
I have a character that is animated with one controller and that uses AnimatorOverrideController to change the animation by script during runtime. The problem is that sometime when a new AnimationClip is set in the AnimatorOverrideController, the animation is shown as playing in the Animator window but it stays at the frame it was before I changed the animation clip. If I pause the game and resume, it seems the Animator realizes it is not playing properly and is fixed.
Here’s how I create my AnimatorOverrideController :
myAnimatorOverrideController = new AnimatorOverrideController(myAnimator);
myAnimator.runtimeAnimatorController = myAnimatorOverrideController ;
Here’s how I change the animation clip and play my animations :
myAnimatorOverrideController[AnimationClipToOverride] = myNewOverrideAnimationClip;
myAnimator.Play(OVERRIDE_ANIMATION_STATE_NAME);
AnimationClipToOverride is a referenceto the default animation clip in myAnimator.
OVERRIDE_ANIMATION_STATE_NAME is the name of the state in myAnimator where AnimationClipToOverride is in.
I have tried using Rebind and Update after updating my override clip but it doesn’t fix the issue. I thought it could be caused by the animations not being loaded since they were not referenced by the animator, but I tried referencing them to see if it would fix the issue but it doesn’t. In all cases, pausing the editor or adding a breakpoint always make the animations play properly.