Class HorizontalLineDrawer
Custom PropertyDrawer for the HorizontalLineAttribute.
Inherited Members
Namespace: Scylla.Core.Editor.Attributes
Assembly: ScyllaCore.Editor.dll
Syntax
[CustomPropertyDrawer(typeof(HorizontalLineAttribute))]
public sealed class HorizontalLineDrawer : PropertyDrawer
Remarks
Renders a solid-color horizontal separator line above the decorated property field.
The line color and thickness are configured through the HorizontalLineAttribute
constructor. A fixed vertical padding of PADDING pixels is applied on both sides
of the line so that it does not crowd adjacent Inspector elements.
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
GetPropertyHeight(SerializedProperty, GUIContent)
Returns the total height required to draw the separator line and the property field below it.
Declaration
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | property | The UnityEditor.SerializedProperty to calculate the height for. |
| GUIContent | label | The label of this property. |
Returns
| Type | Description |
|---|---|
| float | The sum of the line thickness (Height), the
|
Overrides
OnGUI(Rect, SerializedProperty, GUIContent)
Draws a solid-color horizontal separator line and then the property field directly beneath it.
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 combined GUI output. The line is drawn at the
top of this rect (offset by half of |
| SerializedProperty | property | The UnityEditor.SerializedProperty to make the custom GUI for. |
| GUIContent | label | The label of this property. |