Mecanim: Backward animations only work in preview, not in game

Hello,

I have a blend tree that works fine when the enemy is set to be moving forward, but when going backward, the legs do not move. The preview for the Animator component shows the character (model and all) moving backward when I slide the “speed” toggle to less than zero, but when the game is running, and the speed is set to less than zero, the legs simply stand still.

The character is being controlled by a navmesh, with the speed and angular speed being passed to mecanim to display the proper animations.

Any idea why this may be breaking during game?

I would check and see if there is a bounds restriction in a part of your code that will not let the animation play backwards at runtime.

I think @DecipherOne is talking about something in your code that’s preventing the speed parameter from being set to a negative number.

For example, NavMeshAgents don’t walk backwards; they turn instead. The speed is never going to be less than zero.

When the game is running, select the enemy and look at the Animator window. Make sure the value of the speed parameter is what you expect.

Ok, let it never be said that I’m not an idiot a lot of the times.

“Loop Pose” wasn’t checked.