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(); }
void Start() { if ((mTesting && !Application.isEditor)) { GameObject.Destroy(this.gameObject); Debug.Log("Destroyed Test Game Instance"); return; } if (mInstance != null && mInstance != this) { GameObject.Destroy(this); return; } mInstance = this; DontDestroyOnLoad(this); InitLogicImplementation(); gameLogicImplementation.Start(); mGameLicense = Helpers.CreateComponentIfNotExists <GameLicense>(this); mGameOptions = Helpers.CreateComponentIfNotExists <GameOptions>(this); mGameState = Helpers.CreateComponentIfNotExists <GameStateManager>(this); mGamePlayer = Helpers.CreateComponentIfNotExists <GamePlayer>(this); mGameMusic = Helpers.CreateComponentIfNotExists <GameMusic>(this); mGameLoca = Helpers.CreateComponentIfNotExists <GameLocalization>(this); mGameLoca.Initialize(); mGamePause = Helpers.CreateComponentIfNotExists <GamePause>(this); mGameInput = Helpers.CreateComponentIfNotExists <GameInput>(this); mSceneTransition = Helpers.CreateComponentIfNotExists <SceneTransition>(this); mGameData = Helpers.CreateComponentIfNotExists <GameData>(this); mFirstFrame = true; }