Пример #1
0
        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());
            }
        }
Пример #2
0
        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();
            }
        }