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() { // 注意:清空所有撤销操作