- Home /
Restoring the size of a sprite after animation is complete/interrupted
I did a search on this and didn't quite find how it is to be done. I have a menu which is made of four sprites, each a button. The navigation is made with an int Index. If Index = 1, then the animation of button 1 is looping, making him slightly smaller and larger. Now, if I press a down button, which makes Index = 2, then the button 2 animates well, but the dimensions of button 1 are changed depending when the animation was interrupted. How can I restore the starting size of the sprite? C#.
I originally thought of making my own Restore(). The Create(), which creates the sprites, would save their dimensions. The restore would bring them back if the animation was interrupted and the object is no longer animated. It's one way, I guess, yet to try it. I just wondered if there is an easier way.
Answer by smoggach · Oct 23, 2014 at 02:00 PM
Animations have a function called Rewind. If you call this when it is interrupted it should return to the first frame. http://docs.unity3d.com/ScriptReference/Animation.Rewind.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613165716im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
After animation completion transition to default animation 1 Answer
(Unity 4.6) Button animations 1 Answer
What's the best art pipeline for 2D animated sprites? 1 Answer
After working in animator controller, sprite won't appear in game mode 0 Answers
Is there a way to Scale Root Motion with the model? 0 Answers