@@ -35,12 +35,14 @@ public override void OnGUI (Rect position,SerializedProperty property,GUIContent
35
35
EditorGUI . BeginProperty ( position , label , property ) ;
36
36
37
37
if ( property . propertyType == SerializedPropertyType . ManagedReference ) {
38
- // Draw the subclass selector popup.
39
- Rect popupPosition = new Rect ( position ) ;
40
- popupPosition . width -= EditorGUIUtility . labelWidth ;
41
- popupPosition . x += EditorGUIUtility . labelWidth ;
42
- popupPosition . height = EditorGUIUtility . singleLineHeight ;
43
38
39
+ // render label first to avoid label overlap for lists
40
+ Rect foldoutLabelRect = new Rect ( position ) ;
41
+ foldoutLabelRect . height = EditorGUIUtility . singleLineHeight ;
42
+ foldoutLabelRect . x += EditorGUI . indentLevel * 12 ;
43
+ Rect popupPosition = EditorGUI . PrefixLabel ( foldoutLabelRect , label ) ;
44
+
45
+ // Draw the subclass selector popup.
44
46
if ( EditorGUI . DropdownButton ( popupPosition , GetTypeName ( property ) , FocusType . Keyboard ) ) {
45
47
TypePopupCache popup = GetTypePopup ( property ) ;
46
48
m_TargetProperty = property ;
@@ -54,8 +56,8 @@ public override void OnGUI (Rect position,SerializedProperty property,GUIContent
54
56
// Draw the property with custom property drawer.
55
57
Rect foldoutRect = new Rect ( position ) ;
56
58
foldoutRect . height = EditorGUIUtility . singleLineHeight ;
57
- property . isExpanded = EditorGUI . Foldout ( foldoutRect , property . isExpanded , label , true ) ;
58
-
59
+ property . isExpanded = EditorGUI . Foldout ( foldoutRect , property . isExpanded , GUIContent . none , true ) ;
60
+
59
61
if ( property . isExpanded )
60
62
{
61
63
using ( new EditorGUI . IndentLevelScope ( ) )
@@ -70,7 +72,7 @@ public override void OnGUI (Rect position,SerializedProperty property,GUIContent
70
72
}
71
73
else
72
74
{
73
- EditorGUI . PropertyField ( position , property , label , true ) ;
75
+ EditorGUI . PropertyField ( position , property , GUIContent . none , true ) ;
74
76
}
75
77
} else {
76
78
EditorGUI . LabelField ( position , label , k_IsNotManagedReferenceLabel ) ;
@@ -95,7 +97,7 @@ TypePopupCache GetTypePopup (SerializedProperty property) {
95
97
96
98
if ( ! m_TypePopups . TryGetValue ( managedReferenceFieldTypename , out TypePopupCache result ) ) {
97
99
var state = new AdvancedDropdownState ( ) ;
98
-
100
+
99
101
Type baseType = ManagedReferenceUtility . GetType ( managedReferenceFieldTypename ) ;
100
102
var popup = new AdvancedTypePopup (
101
103
TypeCache . GetTypesDerivedFrom ( baseType ) . Append ( baseType ) . Where ( p =>
@@ -118,7 +120,7 @@ TypePopupCache GetTypePopup (SerializedProperty property) {
118
120
119
121
object obj = individualProperty . SetManagedReference ( type ) ;
120
122
individualProperty . isExpanded = ( obj != null ) ;
121
-
123
+
122
124
individualObject . ApplyModifiedProperties ( ) ;
123
125
individualObject . Update ( ) ;
124
126
}
0 commit comments