Open CornLizard opened 4 years ago
Hello, I'm trying to use UniTask in the editor and when I call Await or SwitchTo it faults. Is UniTask supposed to work in the editor?
Edit: It only ever reaches and calls Debug.Log("0");
using UniRx.Async; using UnityEngine; [ExecuteAlways] public class Test : MonoBehaviour { private UniTask task; private bool isRunning; private void Start() { task = UniTask.Run(Update); } private async UniTask Update() { isRunning = true; while (isRunning) { Debug.Log("0"); await UniTask.Yield(); Debug.Log("1"); await UniTask.SwitchToTaskPool(); Debug.Log("2"); await UniTask.SwitchToMainThread(); Debug.Log("3"); } } private void OnDestroy() { isRunning = false; task.GetAwaiter().GetResult(); } }
Hello, I'm trying to use UniTask in the editor and when I call Await or SwitchTo it faults. Is UniTask supposed to work in the editor?
Edit: It only ever reaches and calls Debug.Log("0");