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. Dismiss Notice

The Any State to Animation the animation is playing wrong.

Discussion in 'Animation' started by akshays, Aug 14, 2016.

  1. akshays

    akshays

    Joined:
    Aug 14, 2016
    Posts:
    14
    Hi I have a death animation which transitions from any state. I am using an integer to hold the state. The number is correctly being inserted with SetInteger(). I see in Unity in the Animator that the line fill only goes from zero to about half way through and recycles. Rest of all the Animator states the line goes all the way to the end of the button. The Animation in the Game Window is showing a jitter half animation that is constantly cycling. I tried loop and still this bug is happening.
     
  2. akshays

    akshays

    Joined:
    Aug 14, 2016
    Posts:
    14
    Ok so if I pull the Any State transition out and make transitions individually from all states to the state that was transition linked to Any State everything works fine. So this is bug to do with Any State. So this is solved with this work around of not using Any State and making transitions from all states instead individual connections.
     
  3. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Any State Transitions, like other transitions, are interruptible. Since AnyState can be triggered in any state (as the name implies), as long as your conditions are valid, your transition will start over and over again.

    To avoid this, either don't use AnyState transition, or make sure that your AnyState transitions depend on a Trigger, so that they don't continually restart.

    Personally, I prefer to avoid AnyState as much as possible, because it makes the state machine hard to debug.
     
  4. Mecanamaral

    Mecanamaral

    Joined:
    Sep 24, 2020
    Posts:
    7
    We have a lot of "avoid as much as possible" in Unity uh ? Why so they did it ?
     
    Tehemus likes this.
  5. akshays

    akshays

    Joined:
    Aug 14, 2016
    Posts:
    14
    Hello Mecanamaral,

    This is a 2016 issue when I was trying to figure out how to use Unity Animations to make a 3D video game. I am not sure why you are commenting on this? Could you be specific and clarify your reply please.
     
  6. Adesnada

    Adesnada

    Joined:
    Oct 14, 2020
    Posts:
    12
    You can avoid that recycling by turning off "can transition to self" and interruption mode to none
     
  7. ismeandrew

    ismeandrew

    Joined:
    Jun 12, 2019
    Posts:
    1
    I finally logged into my Unity account on the forums just so I could like your comment.