- Home /
Animation Rewind does not set object back to original state
Is this supposed to set the object like it is when on frame 0? i tried using this:
function rewindAllAnimation()
{
for (var i : int = 0; i < gameObjectsToRewind.length; i++)
{
gameObjectsToRewind[i].transform.animation.Rewind();
}
}
I was hoping that the objects im trying to rewind would return to their state before played animations. Is this the right way to go about doing this?
EDIT
I have noticed that if i call the rewind function WHILE the animation is playing, it resets it to its first frame, but continues to play to the end again. If i call this after it has completed animating it does nothing... WHAT AM I MISSING!? This seems like it should be so simple. Please point out my newbie mistake :)
Answer by runevision · Apr 28, 2010 at 11:21 AM
Rewind() sets the time to 0. It does not do anything else. If a clip was playing, it will keep playing but from the beginning. If a clip was not playing, it will still not be playing (but it will start from time 0 next time you start it).
Answer by Jason_DB · Apr 28, 2010 at 10:29 AM
Well I think that if you called animation.Stop
in the same place where you rewind it, then the animation wouldn't keep playing.
Answer by MaDDoX · May 16, 2010 at 03:02 PM
If you want to resume your animation later on, use animationState.speed = 0; To resume it, animationState.speed = 1;
BTW, it's a common mistake confusing animation (collection of animations) with animationState (the actual, individually named "clip"), make sure you're accessing the right one.
Good luck!
Your answer
![](https://koobas.hobune.stream/wayback/20220612195031im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can I make animations snap to a frame? 1 Answer
Trouble with animation Rewind/stop 0 Answers
Need help with animation rewind 1 Answer
Animation Keyframes Not Triggering? 0 Answers