Jestus
Jestus

Reputation: 635

Unity 2D Animation Not Changing States

I have a pretty simple question:

I've set up the Unity Animator, with a rudimentary "Idle" state and "WalkRight" state. There's a boolean I have to transition between Idle and WalkRight.

However, for some reason, I can't get my character to transition from Idle->WalkRight when WalkRight is true.

If I set WalkRight animation to be default and the boolean is false, it will transition to Idle, however not vice versa.

Here is an image of the issue in practice:

Not transitioning!

As you can see, WalkRight = true at the bottom, and (I believe) the transition is set up correctly on the right.

What am I doing incorrectly?

Thanks!

Upvotes: 1

Views: 1852

Answers (2)

Jestus
Jestus

Reputation: 635

I finally figured it out. It hadn't saved my script properly, so it was using old code setting "WalkRight" to false.

Thanks!

Upvotes: 0

Baher Ramzy
Baher Ramzy

Reputation: 171

I believe you have to have a script that changes the WalkRight boolean when the player makes the correct input. Should look something like the following:

Animator anim = GetComponent<Animator>();

anim.SetBool("WalkRight", true); 

Upvotes: 1

Related Questions