Question about Coroutines and waiting for a function to finish
IEnumerator f() {
Debug.Log("f() started");
yield return StartCoroutine(g());
Debug.Log("f() is done");
}
IEnumerator g() {
Debug.Log("g() started");
while (something)
yield return null;
Debug.Log("g() is done");
}
// Somewhere else you start f() like this:
StartCoroutine(f());
this will print:
"f() started"
"g() started"
"g() is done"
"f() is done"
Comentarios
Publicar un comentario