Class ScyllaUILengthDrawer
UI Toolkit property drawer for ScyllaUILength. Renders a numeric field plus a px / % unit toggle button, matching the CSS-devtools convention for length editing in browser inspectors.
Inherited Members
Namespace: Scylla.Core.Editor.Util.UI.Layout
Assembly: ScyllaCore.Editor.dll
Syntax
[CustomPropertyDrawer(typeof(ScyllaUILength))]
public sealed class ScyllaUILengthDrawer : PropertyDrawer
Remarks
Each property persists its current unit through the value's
_unit serialized field, so reopening a scene preserves the px / %
choice without designer effort.
Methods
CreatePropertyGUI(SerializedProperty)
Builds the UI Toolkit property UI for a ScyllaUILength field. The returned element is a horizontal row containing a label (the property's display name), a bound UnityEngine.UIElements.FloatField for the numeric value, and a UnityEngine.UIElements.Button that toggles between "px" and "%" unit labels.
Declaration
public override VisualElement CreatePropertyGUI(SerializedProperty property)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | property | The serialized property representing the ScyllaUILength struct. |
Returns
| Type | Description |
|---|---|
| VisualElement | A UnityEngine.UIElements.VisualElement containing the complete length editor row. |
Overrides
Remarks
The UnityEngine.UIElements.FloatField is bound via
BindProperty so undo/redo, multi-object editing, and prefab-override
indicators work without manual ApplyModifiedProperties calls.
The toggle button uses TrackPropertyValue on the unit serialized
property so its label stays in sync after undo, redo, or multi-object edits
even though a UnityEngine.UIElements.Button cannot bind directly to an enum field.