- Home /
Editor crashes on EditorWindow.Close()
I have an editor script that, under certain circumstances (in this case, cancelling a Open File dialog) has to close pretty much as soon as it opens. I know this method works (somewhat, it does cause an error, but it's harmless), I use it on another script, but in this one, it's crashing.
string path = "";
void OnEnable()
{
path = EditorUtility.OpenFilePanel("Open", Application.dataPath, "csv");
}
void OnGUI()
{
try
{
if (path == "")
{
this.Close();
return;
}
}
catch
{
Debug.Log("Something went wrong");
}
GUILayout.Label("Something", "Something else");
}
It doesn't produce any errors, but as soon as I press cancel, the editor crashes. The editor log doesn't contain anything useful either.
Has anyone else experiences this? Alternatively, does anyone know a better way to close an editor window?
This is happening to everyone at the office on a $$anonymous$$ac. Any suggestions?
Your answer
Follow this Question
Related Questions
Can't move GameObject in Scene view with Unity Components attached 2021.2.2f 0 Answers
Editor crashes after build on any platform 1 Answer
How do I wait until after AssetDatabase creates an assets before carrying out another function ? 0 Answers
Editor crash on max osx 0 Answers
Change Editor Cursor 1 Answer