Any guesses?! Reset an animation...

“Best way to stop and “reset” an Animation?”

Say you’re playing an animation, so


You want to stop the animation playing, and, you want it to simply return to the “original” “first” static state.

You want everything to be really clean so it is ready to use again with no problems, no other animations are disturbed, etc etc etc.

I’ve never really know the best way to do this.

I’ve seen and use code like either this…

blah.animation["spinTheLogo"].time = 0.0;

or this …

blah.animation["spinTheLogo"].time = 0.0;
blah.animation["spinTheLogo"].enabled = false;

But I really don’t understand any subtleties between the two.

And there seems to be other ways to do it as well … along the lines of using animationtate-something-zero … and I don’t understand those either.

In a word what is the usual, best, and correct idiom when you want to “have an animation simply stop immediately, and immediately return to the unperturbed state?, ideally causing no other trouble, leaving the animation easily usable in the future, and for example not disturbing any other animations running on the same object or subobjects?”


When I’ve done this recently, I’ve gone with the latter of the two.

If you didn’t disable the animation, then the animation will continue to play at whatever speed is set to.

Calling sample, I think would be necessary in order to ensure that the update occurs, as in my experience setting the animation to enabled = false will prevent any further updates.

blah.animation.Stop(“name”); is a better way to go, because it resets multiple properties (time, enabled, weight).