Esempio n. 1
0
 void MainTest()
 {
     UnityTask.RunOnMain(() =>
     {
         Debug.Log("Sleeping...");
         UnityTask.Delay(2000);
         Debug.Log("Slept");
     });
 }
Esempio n. 2
0
        void BackgroundToMain()
        {
            UnityTask.Run(() =>
            {
                Debug.Log("Thread A Running");

                var task = UnityTask.RunOnMain(() =>
                {
                    Debug.Log("Sleeping...");
                    UnityTask.Delay(2000);
                    Debug.Log("Slept");
                });

                while (task.IsRunning)
                {
                    Debug.Log(".");
                    UnityTask.Delay(100);
                }

                Debug.Log("Thread A Done");
            });
        }