Asynchronous function in Unity
Async and await keyword Since Unity 2019, Unity introduces C# task and async/await keyword to MonoBehaviour. For Unity callback functions like Start, Update, now it supports the async version, and with the async keyword in the front, the function now will be dispatched asynchronously automatically by the engine. private async void Start() { Debug.Log("Start task delay 2 seconds"); await Task.Delay(TimeSpan.FromSeconds(2)); Debug.Log("Task delay 2 finished"); } The function on the above will be executed and the first log shows immediately while the second log shows after 2 seconds....