IEnumerator InitializeInternal() { initialized = true; Instance = this; DontDestroyOnLoad(this); ThreadingBridge.Initialize(); // for webgl we cannot use custom attributes to find classes, so we rely on a delegate to create the logic instance for us. Initialize(); #if UNITY_WEBGL webGLHelper = this.AddComponentIfNotExists <WebGLPlatformHelper>(); #endif gameOptions = this.AddComponentIfNotExists <GameOptions>(); gameMusic = this.AddComponentIfNotExists <GameMusic>(); gameLoca = this.AddComponentIfNotExists <GameLocalization>(); gameLoca.Initialize(); gameInput = this.AddComponentIfNotExists <GameInput>(); sceneTransition = this.AddComponentIfNotExists <SceneTransition>(); objectPool = new ObjectPool(); yield return(new WaitForEndOfFrame()); GameSetupReady(); }
public static void Dispatch(System.Action callback) { if (callback == null) { return; } ThreadingBridge.Dispatch(() => { callback(); }); }
public static void CallThreadedFunction(Action action) { ThreadingBridge.ExecuteThreaded(() => { try { action(); }catch (Exception e) { ThreadingHelper.Dispatch(() => { throw e; }); } }); }
public static void QueueUserWorkItem(ThreadCallback callback) { ThreadingBridge.ExecuteThreaded(() => { callback(null); }); }