- Home /
Controlling an Animation's playback through the Animator Component?
I've looked around for some answers but have unfortunately come up short;
I'm trying to see if there's a way to control an Animation's playback (play, stop, go to a specific frame, etc) through the Animator Component while the Animation is the Animator's current State.
For Example, I have a Button in my UI that has a still image within it, with an Animator component attached to it. When the user hovers over the button, the image should Animate, and when the user hovers away from the button, I'd like the image's animation to stop and go back to the first frame of the animation.
Currently, I have my code set to disable/enable the image's Animator component on hover over/out, which works, but it stops the animation at the current frame, and I'd like for it to revert back to frame 1 (or another specific frame if so chosen). I'm also aware that I can make a second animation file of just the first frame of the animation and use that as a State in the Animator component, but I'm still curious if there are ways to control an Animator Component's current State's animation's playback (For those of you who have used Adobe Flash back in the day, I'm basically trying to accomplish stop(), play(), and goToAndStop() through Unity's Animator component)
Sorry for such a newbie question, but any guidance is appreciated. If more info is needed I'll gladly provide. Thanks in advance :)