浏览代码

fix crash when editor closes

/main
xingwei.zhu 5 年前
当前提交
8c76f668
共有 1 个文件被更改,包括 23 次插入0 次删除
  1. 23
      Runtime/editor/editor_window.cs

23
Runtime/editor/editor_window.cs


#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() {

正在加载...
取消
保存