|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
public abstract class UIWidgetsEditorWindow : EditorWindow, WindowHost { |
|
|
|
WindowAdapter _windowAdapter; |
|
|
|
|
|
|
|
static readonly List<UIWidgetsEditorWindow> _activeEditorWindows = new List<UIWidgetsEditorWindow>(); |
|
|
|
[InitializeOnLoadMethod] |
|
|
|
static void _OnBaseEditorWindowLoaded() |
|
|
|
{ |
|
|
|
EditorApplication.quitting += () => |
|
|
|
{ |
|
|
|
foreach (var editorWindow in _activeEditorWindows) { |
|
|
|
editorWindow.OnDisable(); |
|
|
|
} |
|
|
|
|
|
|
|
_activeEditorWindows.Clear(); |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_activeEditorWindows.Add(this); |
|
|
|
} |
|
|
|
|
|
|
|
void OnDestroy() { |
|
|
|
if (_activeEditorWindows.Contains(this)) { |
|
|
|
_activeEditorWindows.Remove(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void OnEnable() { |
|
|
|