In Unity coroutines and async basically do the same. But coroutines work better with Unity, while async is more powerfull.
Run function asynchronously with delay
| Coroutine | Async |
|---|---|
Since the |
|
Wait for return data
| Coroutine | Async |
|---|---|
A coroutine cannot directly return data, because it is already returning the IEnumerator. You can work around this limitation by writing the result into a global variable, but this is not ideal since it hides what the method is actually doing. |
|
Run functions asynchronously one after the other
| Coroutine | Async |
|---|---|
|
|
Run functions asynchronously, but wait for all to finish
| Coroutine | Async |
|---|---|
|
|