@@ -35,12 +35,14 @@ public override void OnGUI (Rect position,SerializedProperty property,GUIContent
3535 EditorGUI . BeginProperty ( position , label , property ) ;
3636
3737 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 ;
4338
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.
4446 if ( EditorGUI . DropdownButton ( popupPosition , GetTypeName ( property ) , FocusType . Keyboard ) ) {
4547 TypePopupCache popup = GetTypePopup ( property ) ;
4648 m_TargetProperty = property ;
@@ -54,8 +56,8 @@ public override void OnGUI (Rect position,SerializedProperty property,GUIContent
5456 // Draw the property with custom property drawer.
5557 Rect foldoutRect = new Rect ( position ) ;
5658 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+
5961 if ( property . isExpanded )
6062 {
6163 using ( new EditorGUI . IndentLevelScope ( ) )
@@ -70,7 +72,7 @@ public override void OnGUI (Rect position,SerializedProperty property,GUIContent
7072 }
7173 else
7274 {
73- EditorGUI . PropertyField ( position , property , label , true ) ;
75+ EditorGUI . PropertyField ( position , property , GUIContent . none , true ) ;
7476 }
7577 } else {
7678 EditorGUI . LabelField ( position , label , k_IsNotManagedReferenceLabel ) ;
@@ -95,7 +97,7 @@ TypePopupCache GetTypePopup (SerializedProperty property) {
9597
9698 if ( ! m_TypePopups . TryGetValue ( managedReferenceFieldTypename , out TypePopupCache result ) ) {
9799 var state = new AdvancedDropdownState ( ) ;
98-
100+
99101 Type baseType = ManagedReferenceUtility . GetType ( managedReferenceFieldTypename ) ;
100102 var popup = new AdvancedTypePopup (
101103 TypeCache . GetTypesDerivedFrom ( baseType ) . Append ( baseType ) . Where ( p =>
@@ -118,7 +120,7 @@ TypePopupCache GetTypePopup (SerializedProperty property) {
118120
119121 object obj = individualProperty . SetManagedReference ( type ) ;
120122 individualProperty . isExpanded = ( obj != null ) ;
121-
123+
122124 individualObject . ApplyModifiedProperties ( ) ;
123125 individualObject . Update ( ) ;
124126 }
0 commit comments