// Use this for initialization void Start() { //Reset all data here or load previous data if exists globalsList.SetGlobalVariable("playerspawnpoint", 0, 0); UnityEngine.SceneManagement.SceneManager.LoadScene("CoreScene"); UnityEngine.SceneManagement.SceneManager.LoadScene("location_2_act_1", UnityEngine.SceneManagement.LoadSceneMode.Additive); }
static void RunFromCurrent() { if (EditorApplication.isPlaying == true) { EditorApplication.isPlaying = false; return; } GlobalVariableList globalsList = (GlobalVariableList)AssetDatabase.LoadAssetAtPath("Assets/Data/GlobalVariables.asset", typeof(GlobalVariableList)); globalsList.SetGlobalVariable("playerspawnpoint", 0, 0); string currentScene = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name; Debug.Log("load"); if (currentScene != "CoreScene") { UnityEditor.SceneManagement.EditorSceneManager.OpenScene("Assets/Scenes/CoreScene.unity"); //UnityEditor.SceneManagement.EditorSceneManager.LoadScene(currentScene, UnityEngine.SceneManagement.LoadSceneMode.Additive); } AddPlayerSpawnPoint(); UnityEditor.SceneManagement.EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo(); EditorApplication.isPlaying = true; }
public static void OnPlayStateChange(PlayModeStateChange playMode) { if (playMode == PlayModeStateChange.EnteredEditMode) { // RemoveGameLogicObjects(); UnityEditor.SceneManagement.EditorSceneManager.CloseScene(UnityEngine.SceneManagement.SceneManager.GetSceneByName("CoreScene"), true); } else if (playMode == PlayModeStateChange.ExitingEditMode) { string currentScene = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().path; if (!currentScene.Contains("StartScene") && !currentScene.Contains("Title")) { GlobalVariableList globalsList = (GlobalVariableList)AssetDatabase.LoadAssetAtPath("Assets/Data/GlobalVariables.asset", typeof(GlobalVariableList)); globalsList.SetGlobalVariable("playerspawnpoint", 0, 0); if (currentScene != "CoreScene") { UnityEditor.SceneManagement.EditorSceneManager.OpenScene("Assets/Scenes/CoreScene.unity"); UnityEditor.SceneManagement.EditorSceneManager.OpenScene(currentScene, UnityEditor.SceneManagement.OpenSceneMode.Additive); } EditorApplication.isPlaying = true; AddPlayerSpawnPoint(); } // AddGameLogicObjects(); } }
public void RunEvent() { for (int i = 0; i < globalVarsToChange.Count; i++) { globalVariableList.SetGlobalVariable(globalVarsToChange[i].globalId, globalVarsToChange[i].state, globalVarsToChange[i].numberData); } if (sceneTransport) { UnityEngine.SceneManagement.SceneManager.LoadScene(sceneToTransport); } }