Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How to "Cancel" an animation immediately

Discussion in '2D' started by theDestroyerOfUniverses, Jul 8, 2020.

  1. theDestroyerOfUniverses

    theDestroyerOfUniverses

    Joined:
    Nov 24, 2018
    Posts:
    6
    Hello,

    I am animating sprite sheets. However, I noticed in my Animation Controller that if my player stops walking, and the animation cycle/state for "walk" has just restarted, although my player has stopped moving, the animation will play until the cycle completes.

    Is it possible, given an exit condition, such as (bool walking = false), as soon as this condition is met in the Animation Controller, we transition to the next state, even if the animation is halfway through playing?

    Thanks!
     
  2. Mooxe

    Mooxe

    Joined:
    Sep 18, 2013
    Posts:
    19
    It's probably cause your transition has "has exit time" set to true.

    Set it to false (Untick) and also change the transition duration to 0.

    https://imgur.com/t1jwHxG