reverse an animation if it's less than half way through?

How do i reverse an animation if a key is released and it’s less than half way through playing?

1 Answer

1

Let’s just say you’re animating a walk cycle:

if (Input.GetKeyUp(KeyCode.W) && animation.isPlaying("walk") && animation["walk"].time < animation["walk"].length / 2) {
	animation["walk"].speed = -speed;
}

I believe that should work.

Hope that helps, Klep

Thanks Kleptomaniac! - it's VERY helpful.

Haha, brilliant! Glad I could help. :P