[Solved] Lizard still moving after SetSpeed to 0

So, I have the animator.SetBool(“isAttacking”, true) working. The Lizard does in fact change from the walking animation to the attacking animation when he fires the OnTriggerEnter2D with the Grave Stone. However, he keeps moving left during the attacking animation. I have an animation event in the Lizard Attacking animation at frame 0 that calls the SetSpeed function with an argument of 0.

When I debug.log in the Attacker.Update method, I can see that the speed is getting set to non-zero numbers, but I can’t find any code that is setting those non-zero speed values. Can anyone suggest what might be going on to cause the Lizard Attacking animation to continue moving left?

It turned out to be an issue with the blend between the Walking and Attacking animations. The Walking animation restarted “in the blend” and so reset the SetSpeed value. I removed the blend between the two animations, and the SetSpeed value for the Attacking animation is being respected.

Same problem. Same solution. Thanks for posting!

Privacy & Terms