6 [CustomPropertyDrawer(typeof(OverrideAltitudeData))]
9 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
11 EditorGUI.BeginProperty(position, label, property);
13 var initialRect = EditorGUI.IndentedRect(position);
15 position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
19 var indent = EditorGUI.indentLevel;
20 EditorGUI.indentLevel = 0;
25 var boolRect =
new Rect(position.x, position.y, 30, height);
26 var altitudeRect =
new Rect(position.x, position.y + 20, 180, height);
27 var altitudeLabelRect =
new Rect(initialRect.x, position.y + height, 50, height);
29 var altitudeModeRect =
new Rect(position.x, position.y + (2 * height), 180, height);
30 var altitudeModeLabelRect =
new Rect(initialRect.x, position.y + (2 * height), 50, height);
32 EditorGUI.PropertyField(boolRect, property.FindPropertyRelative(
"OverrideAltitude"), GUIContent.none);
34 if (property.FindPropertyRelative(
"OverrideAltitude").boolValue)
36 var x =
new GUIContent();
37 var y =
new GUIContent();
39 EditorGUI.PrefixLabel(altitudeLabelRect, x);
41 EditorGUI.PropertyField(altitudeRect, property.FindPropertyRelative(
"Altitude"), GUIContent.none);
43 y.text =
"Altitude Mode";
44 EditorGUI.PrefixLabel(altitudeModeLabelRect, y);
45 EditorGUI.PropertyField(altitudeModeRect, property.FindPropertyRelative(
"AltitudeMode"), GUIContent.none);
48 EditorGUI.indentLevel = indent;
50 EditorGUI.EndProperty();
53 public override float GetPropertyHeight(SerializedProperty property,
56 if (property.FindPropertyRelative(
"OverrideAltitude").boolValue)
58 return base.GetPropertyHeight(property, label) * 2 + 20;
62 return base.GetPropertyHeight(property, label);