- Home /
Invoking does not work, but why?
private var delayTime : float = 4;
function Start() { InvokeRepeating("animateObject",0,16); print("started"); yield WaitForSeconds(3); print("Finish"); CancelInvoke("animateObject"); }
/**function Update () {
}**/
function animateObject() {
print("run");
//animation.Rewind("Rise"); animation.Play("Rise");
yield WaitForSeconds(delayTime);
//animation.Rewind("Stand"); animation.Play("Stand");
yield WaitForSeconds(delayTime);
//animation.Rewind("Stand"); animation.Play("Stand");
yield WaitForSeconds(delayTime);
//animation.Rewind("Stand"); animation.Play("Stand");
yield WaitForSeconds(delayTime);
//animation.Rewind("Sink"); animation.Play("Sink");
}
The invoking does not work... why oO?
Nothing is wrong in the debug, its just the run print never shows up... so it is broken at the invoking
Answer by Eric5h5 · Apr 21, 2011 at 12:06 AM
You can't invoke coroutines. You can rewrite that as a coroutine using a loop instead of using InvokeRepeating.
Not sure what to say without repeating myself. You can't invoke coroutines. If your function is a coroutine, you can't invoke it. As simple as that.
Your answer
![](https://koobas.hobune.stream/wayback/20220613124129im_/https://answers.unity.com/themes/thub/images/avi.jpg)