- Home /
Question by
fireapache · Mar 09, 2011 at 10:00 PM ·
staticyield
Static IEnumerator!?
Hey folks, I have a function that just don't run... summarizing, is this:
//Js
class Joemerson { static funtion Falar(n : int) { ... while (shomething) { yield WaitForEndOfFrame(); } } }
This function needs to be called by another scripts, sometimes.
Please, help!
Comment
Best Answer
Answer by Mike 3 · Mar 09, 2011 at 10:24 PM
You'd have to start it with StartCoroutine from the other classes
Well, this won't work because coroutines are bound to the $$anonymous$$onoBehaviour script that invokes it. StartCoroutine is a (non static) member function of $$anonymous$$onoBehaviour so it needs a script instance to run on.