From 67b2b886a808883f2923436e2cddc3bb969fc1ad Mon Sep 17 00:00:00 2001 From: hevinci Date: Tue, 26 Dec 2023 11:40:47 +0800 Subject: [PATCH] fix #220 --- .../AssetBundleCollectorWindow.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs index 85fb93d..074db5b 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorWindow.cs @@ -65,9 +65,6 @@ namespace YooAsset.Editor public void CreateGUI() { - Undo.undoRedoPerformed -= RefreshWindow; - Undo.undoRedoPerformed += RefreshWindow; - try { _collectorTypeList = new List() @@ -347,6 +344,15 @@ namespace YooAsset.Editor Debug.LogError(e.ToString()); } } + public void OnEnable() + { + Undo.undoRedoPerformed += RefreshWindow; + } + public void OnDisable() + { + if (Undo.undoRedoPerformed != null) + Undo.undoRedoPerformed -= RefreshWindow; + } public void OnDestroy() { // 注意:清空所有撤销操作