How do I make animation transitions one-way only?

Say I have two animation states in my animation controller state machine, and one transition.

As you can see, after entering the state machine there is only one transition: the transition from A to B. If myBool is set to true, the state machine transitions from State A to State B. However, I have not defined a transition to get from State B back to State A. However, despite this, if I then set myBool back to false, the state machine transitions from State B back to State A.

Why does that happen? I have not defined a transition from State B to State A, so the previous transition must be backing itself out. How do I make the A → B transition a 1 way street? Once I’m in State B, I don’t care what myBool is equal to, so any further changes to its value should never change the state away from State B.

Is it possible to get this sort of behavior?

That transition is already one-way only. Are you sure you’re not explicitly telling the Animator to play A? Is there a transition from “Any State” to “State A”?

There are no transitions from any other state to State A. I can even verify the issue in my Animator window in the editor. If I start my game, I can check/uncheck the little MyBool checkbox in the parameters tab of the Animator window. When I check it, it moves from State A to State B. When I uncheck it, it moves back to State A, even though I’ve defined no transition from State B to State A.

1 Like