@@ -98,11 +98,23 @@ private static ReorderableList CreateReoderableList(SerializedProperty property)
98
98
var list = new ReorderableList ( property . serializedObject , itemListProperty , true , false , true , true ) ;
99
99
list . drawElementCallback += ( Rect rect , int index , bool isActive , bool isFocused ) =>
100
100
{
101
+ var itemProperty = itemListProperty . GetArrayElementAtIndex ( index ) ;
101
102
Rect objectRect = new Rect ( rect . x , rect . y + 2 , rect . width * 2 / 3 , rect . height - 4 ) ;
102
- EditorGUI . PropertyField ( objectRect , itemListProperty . GetArrayElementAtIndex ( index ) , GUIContent . none ) ;
103
+ GUIContent label = GUIContent . none ;
103
104
104
- Rect weightRect = new Rect ( objectRect . xMax + 5 , objectRect . y , rect . width - objectRect . width - 5 , objectRect . height ) ;
105
+ if ( itemProperty . hasVisibleChildren )
106
+ {
107
+ label = new GUIContent ( itemProperty . displayName , itemProperty . tooltip ) ;
108
+ objectRect . x += 10 ;
109
+ objectRect . width -= 10 ;
110
+ }
111
+
112
+ EditorGUI . PropertyField ( objectRect , itemProperty , label , true ) ;
113
+
114
+ Rect weightRect = new Rect ( objectRect . xMax + 5 , objectRect . y , rect . width * 1 / 3 - 5 , EditorGUIUtility . singleLineHeight ) ;
105
115
EditorGUI . PropertyField ( weightRect , weightListProperty . GetArrayElementAtIndex ( index ) , GUIContent . none ) ;
116
+
117
+
106
118
} ;
107
119
108
120
list . drawElementBackgroundCallback += ( Rect rect , int index , bool isActive , bool isFocused ) =>
@@ -116,7 +128,7 @@ private static ReorderableList CreateReoderableList(SerializedProperty property)
116
128
117
129
if ( ! isActive )
118
130
GUI . backgroundColor *= 0.6f ;
119
-
131
+
120
132
Style . sliderRange . Draw ( rect , GUIContent . none , false , false , false , false ) ;
121
133
GUI . backgroundColor = previous ;
122
134
} ;
@@ -140,6 +152,11 @@ private static ReorderableList CreateReoderableList(SerializedProperty property)
140
152
return list . selectedIndices . Count == 1 ;
141
153
} ;
142
154
155
+ list . elementHeightCallback += ( int index ) =>
156
+ {
157
+ return Mathf . Max ( EditorGUIUtility . singleLineHeight + 2f , EditorGUI . GetPropertyHeight ( itemListProperty . GetArrayElementAtIndex ( index ) ) ) ;
158
+ } ;
159
+
143
160
// For fancy footer that allows adjustment of the total sum on the fly, see the following gist:
144
161
// https://i.lu.je/2022/Unity_HoZtERJPs6.png
145
162
// https://gist.github.com/Lachee/e76299f00b334b741a6bccd82229e907
@@ -326,9 +343,10 @@ private void DrawSliderBox(Rect area, List<WeightSlider> weights, int activeWeig
326
343
327
344
void IRistBoxLabelDrawer . DrawLabel ( Rect position , RandomListEditorStyle style , SerializedProperty property , float weight , bool isMini )
328
345
{
346
+ var name = property . hasVisibleChildren ? property . displayName : property . GetValueName ( ) ;
329
347
var label = isMini
330
- ? property . GetValueName ( )
331
- : string . Format ( "{0}\n {1:0}%" , property . GetValueName ( ) , weight * 100 ) ;
348
+ ? name
349
+ : string . Format ( "{0}\n {1:0}%" , name , weight * 100 ) ;
332
350
333
351
style . sliderText . Draw ( position , label , false , false , false , false ) ;
334
352
}
0 commit comments