@@ -35,19 +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
-
38
+
39
39
// render label first to avoid label overlap for lists
40
40
Rect foldoutLabelRect = new Rect ( position ) ;
41
41
foldoutLabelRect . height = EditorGUIUtility . singleLineHeight ;
42
42
foldoutLabelRect . x += EditorGUI . indentLevel * 12 ;
43
- EditorGUI . PrefixLabel ( foldoutLabelRect , label ) ;
44
-
45
- // Draw the subclass selector popup.
46
- Rect popupPosition = new Rect ( position ) ;
47
- popupPosition . width -= EditorGUIUtility . labelWidth ;
48
- popupPosition . x += EditorGUIUtility . labelWidth ;
49
- popupPosition . height = EditorGUIUtility . singleLineHeight ;
43
+ Rect popupPosition = EditorGUI . PrefixLabel ( foldoutLabelRect , label ) ;
50
44
45
+ // Draw the subclass selector popup.
51
46
if ( EditorGUI . DropdownButton ( popupPosition , GetTypeName ( property ) , FocusType . Keyboard ) ) {
52
47
TypePopupCache popup = GetTypePopup ( property ) ;
53
48
m_TargetProperty = property ;
@@ -62,7 +57,7 @@ public override void OnGUI (Rect position,SerializedProperty property,GUIContent
62
57
Rect foldoutRect = new Rect ( position ) ;
63
58
foldoutRect . height = EditorGUIUtility . singleLineHeight ;
64
59
property . isExpanded = EditorGUI . Foldout ( foldoutRect , property . isExpanded , GUIContent . none , true ) ;
65
-
60
+
66
61
if ( property . isExpanded )
67
62
{
68
63
using ( new EditorGUI . IndentLevelScope ( ) )
@@ -102,7 +97,7 @@ TypePopupCache GetTypePopup (SerializedProperty property) {
102
97
103
98
if ( ! m_TypePopups . TryGetValue ( managedReferenceFieldTypename , out TypePopupCache result ) ) {
104
99
var state = new AdvancedDropdownState ( ) ;
105
-
100
+
106
101
Type baseType = ManagedReferenceUtility . GetType ( managedReferenceFieldTypename ) ;
107
102
var popup = new AdvancedTypePopup (
108
103
TypeCache . GetTypesDerivedFrom ( baseType ) . Append ( baseType ) . Where ( p =>
@@ -125,7 +120,7 @@ TypePopupCache GetTypePopup (SerializedProperty property) {
125
120
126
121
object obj = individualProperty . SetManagedReference ( type ) ;
127
122
individualProperty . isExpanded = ( obj != null ) ;
128
-
123
+
129
124
individualObject . ApplyModifiedProperties ( ) ;
130
125
individualObject . Update ( ) ;
131
126
}
0 commit comments