// Awake function needs to set some defaults and then check for evidence of a previously loaded scene! // void Awake() { // Apply default quality settings. { Application.targetFrameRate = -1; Assert.raiseExceptions = true; Time.fixedDeltaTime = 1.0f / 60.0f; } // Check for "Development Mode": // If an object called P_SceneID exists then it's a hangover from a scene that was loaded in the editor // when Play was pressed. If this exists then we're in dev mode. Shortcut the menus and setup everything // so we can play the game immediately. if (Application.isEditor) { GameObject go = GameObject.Find("P_SceneID"); if (null != go) { DevModeCheck gc = go.GetComponent <DevModeCheck>(); if (null != gc) { m_sDevmodeRoomToLoad = gc.m_sSceneName; Destroy(go); } } } // Set our delegate for scene loaded events SceneManager.sceneLoaded += SceneLoaded; }
void Awake() { // This must never die! DontDestroyOnLoad(GameObject.Find("PersistentObjects")); // Check for Dev Mode GameObject obj = GameObject.Find("DevModeCheck"); if (null != obj) { Debug.Log("Found a DevModeCheck from open scene, entering dev mode..."); DevModeCheck scene = obj.GetComponent <DevModeCheck>(); m_sDevModeSceneToLoad = scene.m_sSceneName; Destroy(obj); } }