From fd282d96d1b9c60591796e639b1e1cc4e16f08de Mon Sep 17 00:00:00 2001 From: hevinci Date: Fri, 14 Apr 2023 15:21:26 +0800 Subject: [PATCH] fix #97 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复着色器变种收集配置无法保存的问题。 --- .../ShaderVariantCollectorSettingData.cs | 7 +++- .../ShaderVariantCollectorWindow.cs | 32 +++++++++++++++++++ .../ShaderVariantCollectorWindow.uxml | 6 ++-- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorSettingData.cs b/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorSettingData.cs index 34a5374..7b097cf 100644 --- a/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorSettingData.cs +++ b/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorSettingData.cs @@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Linq; using UnityEngine; using UnityEditor; @@ -20,6 +19,11 @@ namespace YooAsset.Editor } } + /// + /// 配置数据是否被修改 + /// + public static bool IsDirty { set; get; } = false; + /// /// 加载配置文件 /// @@ -35,6 +39,7 @@ namespace YooAsset.Editor { if (Setting != null) { + IsDirty = false; EditorUtility.SetDirty(Setting); AssetDatabase.SaveAssets(); Debug.Log($"{nameof(ShaderVariantCollectorSetting)}.asset is saved!"); diff --git a/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorWindow.cs b/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorWindow.cs index da6204b..46e9d39 100644 --- a/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorWindow.cs +++ b/Assets/YooAsset/Editor/ShaderVariantCollector/ShaderVariantCollectorWindow.cs @@ -20,6 +20,7 @@ namespace YooAsset.Editor private List _packageNames; + private Button _saveButton; private Button _collectButton; private TextField _collectOutputField; private Label _currentShaderCountField; @@ -40,6 +41,10 @@ namespace YooAsset.Editor visualAsset.CloneTree(root); + // 配置保存按钮 + _saveButton = root.Q