public IEnumerator Load (int id)
{
Debug.Log("This is the first");
yield return 0;
Debug.Log("This is the second");
}
//Code that is executed first
Debug.Log("Starting");
Loader loader = new Loader();
loader.Load(1);
Debug.Log("Ending");
Well, I don’t know why messages “This is the first” and "This is the second are not printing.
I expect from this example following output:
“Starting”, “This is First One”, “Ending”, “This is Second One”
It seems that it works as intended using StarCoroutine. I thought I should only use StartCoroutine when in Update or FIxedUpdate, or this what I remember docs stated :/.
The confusion may come from the fact that StartCoroutine() is implicit (i.e. you don’t need to use it at all) in UnityScript; in C#, as dreamora said, it is required.