From 27629cdd7c9dd64c053a92fcd69119efffe4a127 Mon Sep 17 00:00:00 2001 From: mob-sakai <12690315+mob-sakai@users.noreply.github.com> Date: Mon, 16 Nov 2026 23:07:55 +0900 Subject: [PATCH] fix: added "Show Readme" to the auto-import menu --- .../Utilities/ShaderSampleImporter.cs | 27 +++++++++++++++++-- .../src/Runtime/UIEffectProjectSettings.cs | 1 + 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Packages/src/Runtime/Internal/Utilities/ShaderSampleImporter.cs b/Packages/src/Runtime/Internal/Utilities/ShaderSampleImporter.cs index 90d6103..84f74fe 100644 --- a/Packages/src/Runtime/Internal/Utilities/ShaderSampleImporter.cs +++ b/Packages/src/Runtime/Internal/Utilities/ShaderSampleImporter.cs @@ -11,11 +11,17 @@ namespace Coffee.UIEffectInternal { internal static class ShaderSampleImporter { + private static string s_ReadmeUrl; private static (string shaderName, string sampleName, string version)[] s_Samples; private static (string guid, string fileName)[] s_DeprecatedShaders; private static readonly Dictionary s_SampleNames = new Dictionary(); private static readonly Dictionary s_ShaderAliases = new Dictionary(); + public static void RegisterReadmeUrl(string url) + { + s_ReadmeUrl = url; + } + public static void RegisterShaderSamples((string shaderName, string sampleName, string version)[] samples) { if (IsBatchOrBuilding()) return; @@ -62,6 +68,10 @@ namespace Coffee.UIEffectInternal if (s_SampleNames.TryGetValue(shaderName, out var sampleName)) { var message = $"Import the sample '{sampleName}' to use the shader '{shaderName}'."; + if (!string.IsNullOrWhiteSpace(s_ReadmeUrl)) + { + message += "\n\nFor details, please see the readme."; + } return ImportSampleIfSelected(sampleName, message); } @@ -85,8 +95,21 @@ namespace Coffee.UIEffectInternal // Import the sample if selected. if (!string.IsNullOrEmpty(message)) { - var selected = EditorUtility.DisplayDialog($"Import {sampleName}", message, "Import", "Cancel"); - if (!selected) return false; + if (!string.IsNullOrWhiteSpace(s_ReadmeUrl)) + { + var selected = EditorUtility.DisplayDialogComplex( + $"Import {sampleName}", message, "Import", "Cancel", "Show Readme"); + if (selected == 2) + { + Application.OpenURL(s_ReadmeUrl); + return false; + } + if (selected != 0) return false; + } + else if (!EditorUtility.DisplayDialog($"Import {sampleName}", message, "Import", "Cancel")) + { + return false; + } } // Remove the imported sample name from the list. diff --git a/Packages/src/Runtime/UIEffectProjectSettings.cs b/Packages/src/Runtime/UIEffectProjectSettings.cs index 5cfbd10..c9b8695 100644 --- a/Packages/src/Runtime/UIEffectProjectSettings.cs +++ b/Packages/src/Runtime/UIEffectProjectSettings.cs @@ -106,6 +106,7 @@ namespace Coffee.UIEffects const string tmpSupport = "TextMeshPro Support"; const string version = "v5.11.0"; #endif + ShaderSampleImporter.RegisterReadmeUrl("https://github.com/mob-sakai/UIEffect#import-additional-resources"); ShaderSampleImporter.RegisterShaderSamples(new[] { // TextMeshPro Support/TextMeshPro Support (Unity 6)