Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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:
    2,605
    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.