playing animation backwards never stops

I’m having a problem where I play an animation backwards like so:

animation["ToOnTapRight"].speed = -1;
animation.Play("ToOnTapRight");

And this works like a charm. The problem is the animation.isPlaying never again returns false, even though the animation isn’t looping or anything. It gets to the first frame, stops animating as expected, but never actually “stops”.

This is causing all sorts of problems because I can’t register when the animation has completely reversed, and thus can’t safely continue to do anything afterwards.


EDIT

I’m currently using the following workaround:

I use a boolean to tell whether or not I am currently reversing the animation, and a float to store the current AnimationState.time, and then simply do this:

if ( reversing )
{
	reverseTime -= Time.deltaTime;
	if ( reverseTime < 0 )
	{
		reversing = false;
		animation.Stop();
	}
}

Anybody have a solution to this?

Maybe it starts another animation, you can also use animation.IsPlaying(“ToOnTapRight”) to check this.

You are correct. It was indeed playing another animation than I told it to, or so it would seem.

I put a print call next to every animation.Play I have, and also put a print( animation.clip.name ) in the workaround above, and the result is this:

//the prints when I call animation.Play()

playing: ToOnTapLeft
reverse playing: ToOnTapLeft

//afterwards when it knows it is reversing

ToUpcomingRight

Note that I never called it to play ToUpcomingRight, but that for some reason animation.clip contains that animationclip. Note also that ToUpcomingRight is the first clip in the array of animations for that object.

Why is it playing this animation, I wonder? Or perhaps it is indeed not “playing” it… but then why does isPlaying return true?

I checked some values, and this is what the following calls returns when it is reversing:

animation.IsPlaying( “ToUpcomingRight” ) → false (makes sense because I didn’t Play() it, but why is animation.clip still pointing to that animation? I’m guessing because the previous animation was done, but then why does isPlaying still return false?)
animation.IsPlaying( “ToOnTapLeft” ) → true ( this seems to confirm my suspicion that it never “stops” playing in reverse )

What I’m saying is you can use animation.IsPlaying(“ToOnTapRight”) to check if only that individual animation is stopped playing. if you use isPlaying it checks if the object plays ANY animation.

Check below for the difference.

Exactly, and what I said was that it returns true, forever…

case in point: http://aaronoostdijk.nl/animationtest.html

This seems to me to be somewhat bug like… perhaps I should post a bug report?