@@ -80,12 +80,16 @@ private void UpdateTypeProperty(SerializedProperty property, Type referenceType)
80
80
property . serializedObject . ApplyModifiedProperties ( ) ;
81
81
}
82
82
83
- private Rect PrepareTypePropertyPosition ( in Rect labelPosition , in Rect inputPosition , bool isPropertyExpanded )
83
+ private Rect PrepareTypePropertyPosition ( bool hasLabel , in Rect labelPosition , in Rect inputPosition , bool isPropertyExpanded )
84
84
{
85
85
var position = new Rect ( inputPosition ) ;
86
- var baseLabelWidth = EditorGUIUtility . labelWidth + labelWidthOffset ;
87
- var realLabelWidth = labelPosition . width ;
88
- var labelWidth = Mathf . Max ( baseLabelWidth , realLabelWidth ) ;
86
+ if ( ! hasLabel )
87
+ {
88
+ position . xMin += EditorGUIUtility . standardVerticalSpacing ;
89
+ return position ;
90
+ }
91
+
92
+ //skip row only if label exists
89
93
if ( isPropertyExpanded )
90
94
{
91
95
//property is expanded and we have place to move it to the next row
@@ -94,8 +98,10 @@ private Rect PrepareTypePropertyPosition(in Rect labelPosition, in Rect inputPos
94
98
return position ;
95
99
}
96
100
101
+ var baseLabelWidth = EditorGUIUtility . labelWidth + labelWidthOffset ;
102
+ var realLabelWidth = labelPosition . width ;
97
103
//adjust position to already rendered label
98
- position . xMin += labelWidth ;
104
+ position . xMin += Mathf . Max ( baseLabelWidth , realLabelWidth ) ;
99
105
return position ;
100
106
}
101
107
@@ -111,7 +117,9 @@ protected override void OnGuiSafe(SerializedProperty property, GUIContent label,
111
117
EditorGUI . indentLevel ++ ;
112
118
var labelRect = propertyScope . LabelRect ;
113
119
var inputRect = propertyScope . InputRect ;
114
- var position = PrepareTypePropertyPosition ( in labelRect , in inputRect , isPropertyExpanded ) ;
120
+
121
+ var hasLabel = ! string . IsNullOrEmpty ( label . text ) ;
122
+ var position = PrepareTypePropertyPosition ( hasLabel , in labelRect , in inputRect , isPropertyExpanded ) ;
115
123
116
124
var parentType = GetParentType ( property , attribute ) ;
117
125
CreateTypeProperty ( position , property , parentType ) ;
0 commit comments