@@ -16,8 +16,10 @@ static SlideDrawer()
16
16
17
17
public override void OnGUI ( Rect position , SerializedProperty property , GUIContent label )
18
18
{
19
- SlideAttribute attr = ( SlideAttribute ) attribute ;
19
+ // Lock the position to the bottom
20
+ position . y = position . y + position . height - EditorGUIUtility . singleLineHeight ;
20
21
22
+ SlideAttribute attr = ( SlideAttribute ) attribute ;
21
23
22
24
// Draw the left and right
23
25
if ( attr . LeftLabel != null )
@@ -34,20 +36,19 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
34
36
EditorGUI . LabelField ( new Rect ( position . x + EditorGUIUtility . labelWidth , position . y + miniLabelVerticalOffset , position . width - EditorGUIUtility . labelWidth + padding , position . height ) , attr . RightLabel , miniLabelStyle ) ;
35
37
}
36
38
37
- Rect sliderBox = new Rect ( position . x , position . y , position . width , EditorGUIUtility . singleLineHeight ) ;
38
-
39
39
// Draw the slider
40
+ Rect sliderPosition = new Rect ( position . x , position . y , position . width , EditorGUIUtility . singleLineHeight ) ;
40
41
switch ( property . propertyType )
41
42
{
42
43
case SerializedPropertyType . Float :
43
- EditorGUI . Slider ( sliderBox , property , attr . Min , attr . Max , label ) ;
44
+ EditorGUI . Slider ( sliderPosition , property , attr . Min , attr . Max , label ) ;
44
45
break ;
45
46
case SerializedPropertyType . Integer :
46
- EditorGUI . IntSlider ( sliderBox , property , ( int ) attr . Min , ( int ) attr . Max , label ) ;
47
+ EditorGUI . IntSlider ( sliderPosition , property , ( int ) attr . Min , ( int ) attr . Max , label ) ;
47
48
break ;
48
49
case SerializedPropertyType . Vector2 :
49
50
case SerializedPropertyType . Vector2Int :
50
- MinMaxSlider ( sliderBox , property , attr . Min , attr . Max , label ) ;
51
+ MinMaxSlider ( sliderPosition , property , attr . Min , attr . Max , label ) ;
51
52
break ;
52
53
default :
53
54
EditorGUI . LabelField ( position , label , new GUIContent ( "Slider must be of type float, int, Vector2, or Vector2Int" ) ) ;
0 commit comments