void OnDisable() { if (AufCtx.Destroyed) { return; } _persistentUndo = Globals <PersistentUndoRedoState> .Value; AufCtx.UpdateGroup.Destroy(); AufCtx.OnGuiGroup.Destroy(); AufCtx.DestroyWorld(); Globals <Config> .Value = default; Globals <PersistentUndoRedoState> .Value = default; Globals <WindowData> .Value = default; EditorApplication.update -= Upd; EditorApplication.projectWindowItemOnGUI -= ProjectViewGui.OnProjectWindowItemOnGui; // need to close window in case of Asset Cleaner uninstalled if (!CleanerStyleAsset.Style.TryFindSelf(out _)) { ForceClose(); } }
// restore window state after recompilation void OnEnable() { var wd = Globals <WindowData> .Value = new WindowData(); wd.Window = this; var firstTime = _persistentUndo == null; Globals <PersistentUndoRedoState> .Value = _persistentUndo ?? new PersistentUndoRedoState(); Globals <BacklinkStore> .Value = new BacklinkStore(); var config = Globals <Config> .Value = new Config(); PersistenceUtils.Load(ref config); if (firstTime || !config.RebuildCacheOnDemand) { Globals <BacklinkStore> .Value.Init(); } EditorApplication.update += Upd; EditorApplication.projectWindowItemOnGUI += ProjectViewGui.OnProjectWindowItemOnGui; AufCtx.TryInitWorld(); // need to close window in case of Asset Cleaner uninstalled if (!CleanerStyleAsset.Style.TryFindSelf(out wd.Style)) { ForceClose(); } }
static void Upd() { if (AufCtx.World == null) { AufCtx.DestroyWorld(); return; } if (!Globals <BacklinkStore> .Value.Initialized) { return; } AufCtx.UpdateGroup.Run(); }