blob: 67cab2ee751d32a9b9486f1ea6fc37d35bc982c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
using UnityEngine;
using UnityEngine.UI;
namespace UnityEditor.UI
{
[CustomPropertyDrawer(typeof(AnimationTriggers), true)]
public class AnimationTriggersDrawer : PropertyDrawer
{
public override void OnGUI(Rect rect, SerializedProperty prop, GUIContent label)
{
Rect drawRect = rect;
drawRect.height = EditorGUIUtility.singleLineHeight;
SerializedProperty normalTrigger = prop.FindPropertyRelative("m_NormalTrigger");
SerializedProperty higlightedTrigger = prop.FindPropertyRelative("m_HighlightedTrigger");
SerializedProperty pressedTrigger = prop.FindPropertyRelative("m_PressedTrigger");
SerializedProperty disabledTrigger = prop.FindPropertyRelative("m_DisabledTrigger");
EditorGUI.PropertyField(drawRect, normalTrigger);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, higlightedTrigger);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, pressedTrigger);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
EditorGUI.PropertyField(drawRect, disabledTrigger);
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
return 4 * EditorGUIUtility.singleLineHeight + 3 * EditorGUIUtility.standardVerticalSpacing;
}
}
}
|