Class MonoTextAreaDrawer
Custom PropertyDrawer for the MonoTextAreaAttribute.
Inherited Members
Namespace: Scylla.Core.Editor.Attributes
Assembly: ScyllaCore.Editor.dll
Syntax
[CustomPropertyDrawer(typeof(MonoTextAreaAttribute))]
public sealed class MonoTextAreaDrawer : PropertyDrawer
Remarks
Renders a string serialized property as a scrollable, multi-line text area that
uses the Scylla default monospace font (ScyllaMono) loaded via
LoadDefaultMono(). This is useful for fields that contain
structured text, code snippets, or any content where character alignment matters.
The text area grows vertically based on the actual number of newlines in the current value, clamped between MinLines and MaxLines. A single-line label using the standard property label is drawn above the text area.
The monospace font is loaded once and cached statically. If the font cannot be found, the drawer falls back to the default UnityEditor.EditorStyles.textArea font without raising an error.
Applying this attribute to a non-string field renders an error label instead of a text area.
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 label row and the dynamically-sized monospace text area 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. When the property is not a string, returns a single-line height. |
| GUIContent | label | The label of this property. |
Returns
| Type | Description |
|---|---|
| float | The height of one standard line (for the label) plus a standard vertical spacing gap,
plus the text area height. The text area height equals the monospace font's line height
multiplied by the clamped line count (between MinLines
and MaxLines), plus |
Overrides
OnGUI(Rect, SerializedProperty, GUIContent)
Draws a label followed by a monospace multi-line text area for the string property.
Declaration
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | position | Rectangle on the screen encompassing the label row and the text area below it. |
| SerializedProperty | property | The UnityEditor.SerializedProperty to draw. Must be of type UnityEditor.SerializedPropertyType.String; otherwise an error label is rendered. |
| GUIContent | label | The property label displayed above the text area. |