From 4c4ddfe1502be0943bec76f87203efc5d2e9db3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=80=9D=E6=B5=B7?= <1464576565@qq.com> Date: Tue, 11 Nov 2025 17:14:00 +0800 Subject: [PATCH] fix --- Editor/Inspector/UXUIEditor.cs | 9 ++++++--- Editor/UX/UXTextMeshPro/UXTextMeshProLocalization.cs | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Editor/Inspector/UXUIEditor.cs b/Editor/Inspector/UXUIEditor.cs index 9b22564..1b8f084 100644 --- a/Editor/Inspector/UXUIEditor.cs +++ b/Editor/Inspector/UXUIEditor.cs @@ -3,6 +3,7 @@ using System.Reflection; using TMPro; using TMPro.EditorUtilities; using UnityEditor; +using UnityEditor.UI; using UnityEngine; using UnityEngine.UI; @@ -37,11 +38,12 @@ internal class UXUIEditor : Editor image.material = AssetDatabase.LoadAssetAtPath(UXGUIConfig.UIDefaultMatPath); } +#if TEXTMESHPRO_SUPPORT [MenuItem("GameObject/UI/UXTextMeshPro")] private static void CreateUXTextMeshPro(MenuCommand menuCommand) { - Type MenuOptionsType = typeof(UnityEditor.UI.ImageEditor).Assembly.GetType("UnityEditor.UI.MenuOptions"); + Type MenuOptionsType = typeof(ImageEditor).Assembly.GetType("UnityEditor.UI.MenuOptions"); InvokeMethod(MenuOptionsType, "AddText", new object[] { menuCommand }); GameObject obj = Selection.activeGameObject; obj.name = "UXTextMeshPro"; @@ -52,7 +54,7 @@ internal class UXUIEditor : Editor [MenuItem("GameObject/UI/UXButton")] public static void CreateUXButton(MenuCommand menuCommand) { - Type MenuOptionsType = typeof(TMPro.EditorUtilities.TMPro_CreateObjectMenu).Assembly.GetType("TMPro.EditorUtilities.TMPro_CreateObjectMenu"); + Type MenuOptionsType = typeof(TMPro_CreateObjectMenu).Assembly.GetType("TMPro.EditorUtilities.TMPro_CreateObjectMenu"); InvokeMethod(MenuOptionsType, "AddButton", new object[] { menuCommand }); GameObject obj = Selection.activeGameObject; obj.name = "UXButton"; @@ -63,7 +65,7 @@ internal class UXUIEditor : Editor [MenuItem("GameObject/UI/UXInput Field")] public static void CreateUXInputField(MenuCommand menuCommand) { - Type MenuOptionsType = typeof(TMPro.EditorUtilities.TMPro_CreateObjectMenu).Assembly.GetType("TMPro.EditorUtilities.TMPro_CreateObjectMenu"); + Type MenuOptionsType = typeof(TMPro_CreateObjectMenu).Assembly.GetType("TMPro.EditorUtilities.TMPro_CreateObjectMenu"); InvokeMethod(MenuOptionsType, "AddTextMeshProInputField", new object[] { menuCommand }); GameObject obj = Selection.activeGameObject; obj.name = "UXInputField"; @@ -80,6 +82,7 @@ internal class UXUIEditor : Editor newTextField.text = oldText; inputField.placeholder = newTextField; } +#endif [MenuItem("GameObject/UI/UXScrollView")] private static void CreateUxRecyclerView() diff --git a/Editor/UX/UXTextMeshPro/UXTextMeshProLocalization.cs b/Editor/UX/UXTextMeshPro/UXTextMeshProLocalization.cs index 1271fc3..a9c04a3 100644 --- a/Editor/UX/UXTextMeshPro/UXTextMeshProLocalization.cs +++ b/Editor/UX/UXTextMeshPro/UXTextMeshProLocalization.cs @@ -1,3 +1,4 @@ +#if TEXTMESHPRO_SUPPORT using System; using System.Collections.Generic; using System.Reflection; @@ -85,3 +86,5 @@ namespace UnityEngine.UI } } } + +#endif