Skip to content

Instantly share code, notes, and snippets.

@bamboo
Last active December 23, 2015 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bamboo/6614827 to your computer and use it in GitHub Desktop.
Save bamboo/6614827 to your computer and use it in GitHub Desktop.
Unity EditorWindow loses state if Scene view is maximized.
using UnityEditor;
public class WindowStateIsLostWhenViewIsMaximized : EditorWindow {
[MenuItem("Window/Bugs/Window State Is Lost When View Is Maximized")]
static void Open() {
EditorWindow.GetWindow<WindowStateIsLostWhenViewIsMaximized>();
}
string _state;
// Steps to reproduce:
// 1. Open this window
// 2. Type something in the text field
// 3. Select the Scene view
// 4. Press <SPACE> to maximize it
// 5. Press <SPACE> to restore it
// 6. Text field lost its state
void OnGUI() {
_state = EditorGUILayout.TextField(_state ?? "");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment