/// <summary> /// Quits Game /// </summary> public void QuitGame() { #if UNITY_EDITOR // if In Unity Editor EditorApplication.ExitPlaymode(); //Exits Playmode #endif Application.Quit(); //Quits Application }
public static void killProcesses() { GameLauncherSettings gls = GameObject.FindObjectOfType <GameLauncherSettings>(); if (gls) { if (gls.enterPlayMode && EditorApplication.isPlaying) { EditorApplication.ExitPlaymode(); } } string gameProcName = PlayerSettings.productName; //Find valid processes of this game Process.GetProcesses().ToList().FindAll( proc => { try { return(!proc.HasExited && proc.ProcessName == gameProcName); } catch { return(false); } }) //And then kill them .ForEach(proc => proc.Kill()); }
public void Exit() { Application.Quit(); #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #endif }
public void QuitGame() { #if UNITY_EDITOR EditorApplication.ExitPlaymode(); // exits playmode when using the editor #endif Application.Quit(); // used to quit to desktop when running the build }
private static void OnPlayModeStateChanged(PlayModeStateChange playModeChange) { if (!IsGhostCompilationEnabled()) { return; } // If we're still compiling the domain will reload and cause an error, so as a safeguard forcibly exit play mode if (playModeChange == PlayModeStateChange.EnteredPlayMode && EditorApplication.isCompiling) { Debug.Log("Cannot enter playmode while editor is compiling"); EditorApplication.ExitPlaymode(); return; } if (playModeChange == PlayModeStateChange.ExitingEditMode && !EditorUtility.scriptCompilationFailed) { if (service.HasPendingChanges()) { //I need to recompile or at least advise that we have potential changes pending. if (service.Settings.autoRecompile) { Debug.Log("Exiting playmode pending changes"); EditorApplication.ExitPlaymode(); System.Threading.Interlocked.Increment(ref service._regenerateChangeCount); return; } if (EditorUtility.DisplayDialog(TxtDialogTitle, TxtDialogMessage, TxtBuild, TxtEnterPlayMode)) { EditorApplication.ExitPlaymode(); System.Threading.Interlocked.Increment(ref service._regenerateChangeCount); } } } }
static void OnBeforeSceneLoadRuntimeMethod() { SettingsObject settings = SettingsHandler.Load(); if (!settings.checkBeforePlay) { return; } Session session = new Session(); session.Refresh(); for (int i = 0; i < session.fields.Count; i++) { //Todo: Make this not an abomination. Field field = session.fields[i]; bool confirmed = (field.preCheck == Field.Check.ConfirmedValue || ((field.allowNull || !settings.warnIfNull) && field.preCheck == Field.Check.ConfirmedNull)); if (!confirmed) { EditorApplication.ExitPlaymode(); EditorApplication.playModeStateChanged += Changed; break; } } }
void Validate() { #if UNITY_EDITOR if (!EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isCompiling ) { return; } if (_sceneAsset == null) { _scenePath = ""; _buildIndex = -1; _sceneName = ""; return; } _buildIndex = SceneUtility.GetBuildIndexByScenePath(_scenePath); if (_sceneAsset != null && _buildIndex == -1) { /* Sadly its not easy to find which gameobject/component has this SceneField, at least not at this point */ Debug.LogError($"A scene [{_sceneName}] you used as reference has no valid build Index", _sceneAsset); // Exit play mode - might be a bit too harsh? #if UNITY_2019_1_OR_NEWER EditorApplication.ExitPlaymode(); #else EditorApplication.isPlaying = false; #endif } #endif }
public static void NextLevel() { var nextIndex = SceneManager.GetActiveScene().buildIndex + 1; var nextSceneName = SceneUtility.GetScenePathByBuildIndex(nextIndex); if (SceneUtility.GetScenePathByBuildIndex(nextIndex).Length == 0) { Debug.Log("Game Over"); #if UNITY_EDITOR if (EditorApplication.isPlaying) { EditorApplication.ExitPlaymode(); } else { Application.Quit(); } #else Application.Quit(); #endif } else { var totalShots = PlayerPrefs.GetInt(TotalShots, 0) + GameManager.Instance.Shots; PlayerPrefs.SetInt(TotalShots, totalShots); SceneManager.UnloadSceneAsync(SceneManager.GetActiveScene().buildIndex); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } }
/// <summary> /// Function that quits the game /// </summary> public void QuitGame() { #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #endif Application.Quit(); }
public void QuitGame() // this is our quit game function { Debug.Log("Quitting Game"); // Logs when the exit button is pressed #if UNITY_EDITOR // This will quit playmode when we are in the game and the exit button is pressed EditorApplication.ExitPlaymode(); #endif Application.Quit(); }
public void OnClickExit() { #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #endif ClickSound(); Application.Quit(); }
public static void ApplicationClose(int exitCode = -1) { Application.Quit(exitCode); #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #endif }
public void QuitGame() { Debug.Log("Quitting Game"); #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #endif Application.Quit(); }
//cierra la aplicacion private void ExitButtonClicked() { if (Application.isEditor) { EditorApplication.ExitPlaymode(); } Application.Quit(); }
public void QuitClick() { #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #else Application.Quit(); #endif }
private void HandleEndClick(Button recordButton, Button reportButton, List <Button> recordingStateBtns) { reportButton.style.display = recordButton.style.display = DisplayStyle.Flex; recordButton.text = "RECORD"; BulkButtonDisplayUpdate(recordingStateBtns, DisplayStyle.None); EditorApplication.ExitPlaymode(); EditorApplication.isPlaying = false; }
//------------------------------------------------- public void OnQuitGameClicked() { #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #else Application.Quit(); #endif }
private void QuitGame() { Debug.Log("Quitting Purgatory..."); #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #else Application.Quit(); #endif }
public IEnumerator QuitGame() { #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #else Application.Quit(); #endif yield return(null); }
public void QuitSimulation() //called with quit button { Debug.Log("Quitting application."); #if UNITY_EDITOR EditorApplication.ExitPlaymode(); //If using unity, run this code, exit play mode #endif Application.Quit(); //if not unity editor, quits app, i.e. once published, this will quit. }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #endif Application.Quit(); } }
private static void OpenLicenseRegistrationForm() { //always exit playmode. EditorApplication.ExitPlaymode(); //var window = GetWindowTypes().Single(s=>s.FullName.Contains("Registration")); //open registration windows var menuItem = new MenuItem("License Spring/Registration"); EditorApplication.ExecuteMenuItem(menuItem.menuItem); }
public void ExitGame() { #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #endif if (!Application.isEditor) { Application.Quit(); } }
/// <summary> /// Quits Game if Escape is Pressed /// </summary> private static void ExitIfEscape() { if (Input.GetKeyDown(KeyCode.Escape)) { #if UNITY_EDITOR //allows function in Unity Editor Runtime to mimic application exit EditorApplication.ExitPlaymode(); #endif Application.Quit(); } }
private static void OnError() { #if UNITY_EDITOR if (Application.isEditor) { EditorApplication.ExitPlaymode(); } else #endif Application.Quit(); }
/// <summary> /// 退出 /// </summary> public void Quit() { // 存一下当前json JsonData.SaveMarkList(markedList); #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #else Application.Quit(); #endif }
void OnPlayButtonValueChanged(ChangeEvent <bool> evt) { if (evt.newValue) { EditorApplication.EnterPlaymode(); } else { EditorApplication.ExitPlaymode(); } }
public void testProfile() { Mesh mesh = (meshFilter.mesh.vertexCount > 0) ? meshFilter.mesh : meshFilter.sharedMesh; Profiler.BeginSample(gameObject.name + ".testProfile()", gameObject); var materials = new List <Material>(); meshRenderer.GetSharedMaterials(materials); var tree = CSG.BSPTreeCreator.Construct(mesh, materials, maxTrianglesInLeaves, nbCandidates, precision); Profiler.EndSample(); EditorApplication.ExitPlaymode(); }
void OnGUI() { if (GUILayout.Button("Stop")) { EditorApplication.ExitPlaymode(); } if (Server.PlayMode.bRun == true) { EditorApplication.EnterPlaymode(); } }
// Start is called before the first frame update void Start() { if (testBoardSpace == null) { Debug.LogError("Test Board Space was not attached to the test script!"); Application.Quit(); #if UNITY_EDITOR EditorApplication.ExitPlaymode(); #endif } }