private void Update() { Func <IEnumerator> action; #if UNITY_WSA && !UNITY_EDITOR while (updateQueue.TryDequeue(out action)) { #else while (updateQueue.Count > 0) { lock (updateQueue) { action = updateQueue.Dequeue(); } #endif action(); } Func <IEnumerator> co; #if UNITY_WSA && !UNITY_EDITOR while (coRoutineQueue.TryDequeue(out co)) { #else while (coRoutineQueue.Count > 0) { lock (coRoutineQueue) { co = coRoutineQueue.Dequeue(); } #endif StartCoroutine(co()); } }
private void LateUpdate() { Func <IEnumerator> action; #if UNITY_WSA && !UNITY_EDITOR while (lateUpdateQueue.TryDequeue(out action)) { #else while (lateUpdateQueue.Count > 0) { lock (lateUpdateQueue) { action = lateUpdateQueue.Dequeue(); } #endif action(); } }