- Home /
Question by
sasanraf · Jul 09, 2014 at 06:11 PM ·
sprite animation
How to restart sprite animations in the script
Hello, I want to play a sprite animation, several times during a game level. It does the job well for the first time but for the second time, it does not start from the first frame. How can I reset the animation to frame 0 after the first play.
By the way, as far as I understand, 'Animation' does not support sprite animations. It only can be used for 3d objects. Am I correct?
Thank you for your help in advance,
void Update ()
{
if (SOMETHING == true)
{
//Start sprite animation from frame 0 ???
anim.SetBool("myAnimation", true);
StartCoroutine (timer());
}
}
IEnumerator timer()
{
yield return new WaitForSeconds (2);
}
}
Comment