Beispiel #1
0
        public static AsyncDispatch Dispatch(Action task)
        {
            lock (dispatchQueue)
            {
                AsyncDispatch dispatch = new AsyncDispatch();


                dispatchQueue.Enqueue(() => { task(); dispatch.FinishedDispatch(); });

                return(dispatch);
            }
        }
Beispiel #2
0
        public static AsyncDispatch Dispatch(IEnumerator task, bool showUI = false)
        {
            lock (dispatchQueue)
            {
                AsyncDispatch dispatch = new AsyncDispatch();

                dispatchQueue.Enqueue(() =>
                {
                    if (showUI)
                    {
                        EditorCoroutineRunner.StartCoroutineWithUI(DispatchCorotine(task, dispatch), "Dispatcher task", false);
                    }
                    else
                    {
                        EditorCoroutineRunner.StartCoroutine(task);
                    }
                });

                return(dispatch);
            }
        }
Beispiel #3
0
        static IEnumerator DispatchCorotine(IEnumerator dispatched, AsyncDispatch tracker)
        {
            yield return(dispatched);

            tracker.FinishedDispatch();
        }