Example #1
0
        private static void OnRuntimeMethodLoad()
        {
            _mainThread = Thread.CurrentThread;
            var go = new GameObject("MainThreadDispatchHelper", typeof(MainThreadDispatchHelper))
            {
                hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector
            };

            DontDestroyOnLoad(go);
            var dispatchHelper = go.GetComponent <MainThreadDispatchHelper>();

            MainThreadDispatcher.GameObject = go;
            dispatchHelper.StartCoroutine(MainThreadDispatcher.DispatcherCoroutine());
        }