Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Animator.Play and Update(deltaTime) are not working

Discussion in 'Animation' started by ramyen_unity, Jan 20, 2021.

  1. ramyen_unity


    Apr 1, 2019
    Hi there,

    I'm stuck in this situation, like Animator is not working properly.
    I'm making the EditorWindow for AnimatorSate to check stuff on it.

    You can see the link about AnimatorClipEditor

    It has some line to set up a Animator for preview.
    And then call like this.

    Code (CSharp):
    1.     m_AvatarPreview.Animator.Play(0, 0, 0);
    2. m_AvatarPreview.Animator.Update(0);
    and then TimeControl handles the Boolean value if play is true or not.

    It's a part of my custom EditorWindow for AnimatorSate

    Code (CSharp):
    1.     private void UpdateAnimation()
    2.     {
    3.         if (animatorPreviewInstance == null || curAnimatorState == null)
    4.             return;
    6.          animatorPreviewInstance.Play(, curlayer, timeControl.normalizedTime);
    7.         animatorPreviewInstance.Update(timeControl.deltaTime);
    8.     }
    The problem that I have right now is when I call Animator.Play and Animator.Update(deltaTime)
    the PreviewInstance made by my code is not animated and it's only translating its root position.

    But when trying to select a animation clip and click a play button in preview below AnimationClipEditor.
    I can see that my previewInstance start animating with that AnimationClip on curAnimatorState.

    I wonder why I can not animate my previewInstance by using Animator.Play() and Update(deltaTime) properly.

    Is there any point that I missing for it?

    Anyone who deal with this same issue?