- Home /
How to stop game from running in editor
I have this and function, and when it is called, I want to show an error on the screen, and then when I press ok, the game in the editor stops instead of keep running.
CODE:
void ShowError()
{
UnityEditor.EditorUtility.DisplayDialog ("Error", "Angle value can't exceed 180 degrees", "Ok", "");
//stop game from running
}
Comment
Best Answer
Answer by Jignesh G. · Jan 16, 2015 at 07:17 PM
#if UNITY_EDITOR
if(EditorApplication.isPlaying)
{
UnityEditor.EditorApplication.isPlaying = false;
}
#endif
This line of code will stop running game in unity editor.
Ye I solved it with Simon's answers, but this is basically the same, tyvm!
Your answer
Follow this Question
Related Questions
Stoping the game takes forever 0 Answers
Start/Stop Playmode from editor script 10 Answers
Getting data from Editor into runtime 2 Answers
Runtime vs. Editor 1 Answer
StreamWriter issue c# 0 Answers