using AlicizaX.Editor; using UnityEditor; namespace UnityEngine.UI { [CustomEditor(typeof(UXGroup))] public class UXGroupInspector : GameFrameworkInspector { private SerializedProperty m_Buttons; private UXGroup _target; private void OnEnable() { _target = (UXGroup)target; m_Buttons = serializedObject.FindProperty("m_Buttons"); } public override void OnInspectorGUI() { serializedObject.Update(); GUI.enabled = false; DrawHotButtonListAlwaysExpanded(m_Buttons); GUI.enabled = true; EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); } private void DrawHotButtonListAlwaysExpanded(SerializedProperty listProp) { EditorGUILayout.LabelField("Hot Buttons", EditorStyles.boldLabel); if (listProp.arraySize == 0) { EditorGUILayout.HelpBox("当前没有绑定任何 UXButton", MessageType.Info); return; } for (int i = 0; i < listProp.arraySize; i++) { var element = listProp.GetArrayElementAtIndex(i); var uxButton = element.objectReferenceValue as UXButton; string name = uxButton != null ? uxButton.name : "Null"; EditorGUILayout.ObjectField($"[{i}] {name}", element.objectReferenceValue, typeof(UXButton), true); } } } }