In the following code example, the coroutine is being called as a normal method - ie, not from a yield in another coroutine and not via StartCoroutine(). the result is that **none** of the code in the coroutine is executed.
i would love to get a runtime error in this situation, or even better, a compile-time error.
anybody know how to do that ?
void test() {
Debug.log("before calling coroutine"); // prints
myCoroutine();
Debug.log("after calling coroutine"); // prints
}
IEnumerator myCoroutine() {
Debug.log("inside the coroutine"); // does not print
yield break;
}
↧