Class MinMaxRangeDrawer
Custom PropertyDrawer for the MinMaxRangeAttribute.
Inherited Members
Namespace: Scylla.Core.Editor.Attributes
Assembly: ScyllaCore.Editor.dll
Syntax
[CustomPropertyDrawer(typeof(MinMaxRangeAttribute))]
public sealed class MinMaxRangeDrawer : PropertyDrawer
Remarks
Replaces the default vector field with a combined min-max slider UI consisting of:
- A label on the left.
- An editable numeric field showing the current minimum value.
- A MinMaxSlider(GUIContent, Rect, ref float, ref float, float, float) spanning the remaining width.
- An editable numeric field showing the current maximum value.
Works with both UnityEngine.Vector2 and UnityEngine.Vector2Int
fields. The x component stores the minimum and the y component stores the
maximum. All values are clamped to the range defined by the attribute and the invariant
min <= max is enforced on every change.
Methods
CreatePropertyGUI(SerializedProperty)
Creates custom GUI with UI Toolkit for the property.
Declaration
public override VisualElement CreatePropertyGUI(SerializedProperty property)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | property | The SerializedProperty to make the custom GUI for. |
Returns
| Type | Description |
|---|---|
| VisualElement | The element containing the custom GUI. |
Overrides
OnGUI(Rect, SerializedProperty, GUIContent)
Draws the min-max slider UI appropriate for the property's vector type.
Declaration
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | position | Rectangle on the screen to use for the property GUI. |
| SerializedProperty | property | The UnityEditor.SerializedProperty to draw. Must be of type UnityEditor.SerializedPropertyType.Vector2 or UnityEditor.SerializedPropertyType.Vector2Int; otherwise an error help box is shown. |
| GUIContent | label | The label to display on the left side of the control. |