using UnityEditor; [CustomEditor(typeof(ButtonEx),true),CanEditMultipleObjects] public class ButtonExEditor:UnityEditor.UI.ButtonEditor { public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.Space(); ButtonEx button = target as ButtonEx; button.interval = EditorGUILayout.FloatField("点击间隔",button.interval); button.customPositiveSound = EditorGUILayout.Toggle("自定义积极音效",button.customPositiveSound); if(button.customPositiveSound) { EditorGUI.indentLevel += 1; button.positiveSound = EditorGUILayout.IntField("积极音效",button.positiveSound); EditorGUI.indentLevel -= 1; } button.customNegativeSound = EditorGUILayout.Toggle("自定义消极音效",button.customNegativeSound); if(button.customNegativeSound) { EditorGUI.indentLevel += 1; button.negativeSound = EditorGUILayout.IntField("消极音效",button.negativeSound); EditorGUI.indentLevel -= 1; } } }