using UnityEditor; using UnityEngine; namespace Data { [CustomPropertyDrawer(typeof(Ability))] public class AbilityDrawer : PropertyDrawer { public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { position = EditorGUI.PrefixLabel(position, label); // next to each other // float width = position.width; // position.width *= 0.45f; // EditorGUI.PropertyField(position, property.FindPropertyRelative("Name"), GUIContent.none); // // position.x += (width - position.width); // EditorGUI.PropertyField(position, property.FindPropertyRelative("Value"), GUIContent.none); // below each other position.height = EditorGUIUtility.singleLineHeight; EditorGUI.PropertyField(position, property.FindPropertyRelative("Name"), GUIContent.none); position.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(position, property.FindPropertyRelative("Value"), GUIContent.none); } public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { // return EditorGUIUtility.singleLineHeight; // next to each other return EditorGUIUtility.singleLineHeight * 2 + EditorGUIUtility.standardVerticalSpacing; // below each other } } }