Exemple #1
0
        public static BackgroundCallbacks getInstance()
        {
#if UNITY_WEBGL
            return(null);
#endif
            if (_instance == null)
            {
                _instance = new BackgroundCallbacks(2);
            }

            return(_instance);
        }
Exemple #2
0
        internal UIWidgetsCoroutine(IEnumerator routine, Window window, bool isBackground = false)
        {
            D.assert(routine != null);
            D.assert(window != null);

            this._routine      = routine;
            this._window       = window;
            this._isBackground = isBackground;

            if (isBackground && BackgroundCallbacks.getInstance() != null)
            {
                this._unhook = BackgroundCallbacks.getInstance().addCallback(this._moveNext);
            }
            else
            {
                this._unhook = this._window.run(TimeSpan.Zero, this._moveNext, periodic: true);
                this._moveNext(true); // try to run the first enumeration in the current loop.
            }
        }