protected void Awake() { if (!UnityVersionHandler.ObjectIsInActiveScene(gameObject)) { // Register self as a "sub-scene" GameObject subSceneOb = new GameObject(); SubScene newSubScene = subSceneOb.AddComponent <SubScene>(); newSubScene.Initialise(this); return; } if (!TestManagerPresence()) { return; } #if UNITY_EDITOR if (!TestOwnComponents()) { return; } #endif GetComponent <KickStarter>().Initialise(); runStart = true; // This is necessary because switching the active scene will cause Start to be re-run }
protected void OnActiveSceneChanged(Scene oldScene, Scene newScene) { isLoading = false; loadingProgress = 0f; SubScene newSceneSubScene = UnityVersionHandler.GetSceneInstance <SubScene> (newScene); if (newSceneSubScene) { // New active scene is a sub-scene newSceneSubScene.MakeMain(); } if (!string.IsNullOrEmpty(oldScene.name)) { SceneInfo oldSceneInfo = GetSceneInfo(oldScene.buildIndex); if (oldSceneInfo != null) { MultiSceneChecker multiSceneChecker = MultiSceneChecker.GetSceneInstance(oldScene); if (multiSceneChecker != null) { // Register as a subscene GameObject subSceneOb = new GameObject(); UnityEngine.SceneManagement.SceneManager.MoveGameObjectToScene(subSceneOb, oldScene); SubScene oldSubScene = subSceneOb.AddComponent <SubScene> (); oldSubScene.Initialise(multiSceneChecker); } } } }
private void Awake() { if (!UnityVersionHandler.ObjectIsInActiveScene(gameObject)) { // Register self as a "sub-scene" GameObject subSceneOb = new GameObject(); SubScene newSubScene = subSceneOb.AddComponent <SubScene>(); newSubScene.Initialise(this); return; } ownKickStarter = GetComponent <KickStarter>(); GameObject taggedMainCamera = GameObject.FindWithTag(Tags.mainCamera); if (taggedMainCamera == null) { ACDebug.LogError("No MainCamera found - please click 'Organise room objects' in the Scene Manager to create one."); } else { if (taggedMainCamera.GetComponent <MainCamera>() == null && taggedMainCamera.GetComponentInParent <MainCamera>() == null) { ACDebug.LogError("MainCamera has no MainCamera component."); } } if (ownKickStarter != null) { KickStarter.mainCamera.OnAwake(); ownKickStarter.OnAwake(); KickStarter.playerInput.OnAwake(); KickStarter.playerQTE.OnAwake(); KickStarter.sceneSettings.OnAwake(); KickStarter.dialog.OnAwake(); KickStarter.navigationManager.OnAwake(); KickStarter.actionListManager.OnAwake(); KickStarter.stateHandler.RegisterWithGameEngine(); } else { ACDebug.LogError("No KickStarter component found in the scene!"); } }