when i run this script on my model the animation plays in a looping mode,
but it doesn’t stop 8 seconds in between. Anyhow to make this works?
function Update ()
{
randomanimation ();
}
function randomanimation ()
{
animation.Play("punch");
yield new WaitForSeconds (8.0);
}
Flynn
2
Even though the function randomanimation() is waiting, Update() isn’t, likewise, it is still getting called every frame.
Try this:
function Start()
{
randomanimation();
}
function randomanimation ()
{
animation.Play("punch");
Invoke("randomanimation",8);
}