Unitynoob
Unitynoob

Reputation: 27

Unity: Animation won't play on trigger

Im having trouble to let Unity play my animations. I gave my character an Animator. In this Animator I have this Animations: Animator

The trigger between these Animations are working fine and are running correctly on play. The idle animation it self is played, while i can't get it to play the walk or the jump Animation in the game (both work fine in the inspector). When on play the triggers are triggered, it even shows the blue bar under the walking or the jumping box, but the animation itself just wont be played in the game.

Here is the code I use to call the triggers:

void Update()
    {
        if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.RightArrow)|| Input.GetKey(KeyCode.A)||Input.GetKey(KeyCode.D))
        {
            anim.SetBool("isWalk", true);
            
        }
        else
        {
            anim.SetBool("isWalk", false);
        }

        if (Input.GetKey(KeyCode.Space))
        {
            anim.SetBool("isJump",true);
        }
        else
        {
            anim.SetBool("isJump", false);
        }
        
    }

And the Transition Conditions (but these are working fine for me):

idle->jump: isJump =true,
jump->idle: isJump =fals,
idle->walk: isWalk =true,
walk->idle: isWalk =false,

screenshot of idle-> walk:

idle->walk

screenshot of walk->idle:

walk->idle

I hope someone can help me with this and please excuse my possibly bad english...

Upvotes: 2

Views: 3930

Answers (1)

Jul
Jul

Reputation: 1

I had the same issue. Solved it by unchecking 'Can Transition To Self' inside the transition pointing to the state that didn't play.

Upvotes: 0

Related Questions