Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Bug Animator play the same animation in the same frame doesn't work!

Discussion in 'Animation' started by Vvvvergram, Aug 3, 2020.

  1. Vvvvergram

    Vvvvergram

    Joined:
    Nov 27, 2017
    Posts:
    1
    Let's say I have 2 animation, "Idle" and "Run". If I call them in this way.

    Code (CSharp):
    1. // before I call this method, I am in "Run" state
    2. void Test()
    3. {
    4.     m_Animator.Play("Idle");
    5.  
    6.     // for me it should play "Run" still, but it plays "Idle" actually
    7.     m_Animator.Play("Run");
    8. }
    9.  
    Is that a bug?

    How could I deal with it?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    1,527
    That's just one of the many stupid things about the way Animator Controllers work. You could report it as a bug, but don't get your hopes up.

    The obvious workaround is to figure out what you want to play separately then only call Play once at the end of your Update method.

    You might also be interested in Animancer (link in my signature) which lets you avoid Animator Controllers and properly control everything in code. This particular issue was actually one of the reasons I made Animancer in the first place.
     
    Vvvvergram likes this.
unityunity