DrawerIndentationAttribute

Simple attribute that specifies the indentation level a property drawer should apply when rendering its content. Property drawers read this attribute to adjust EditorGUI.indentLevel before drawing.

Definition

Namespace: Paragon.Editor Assembly: Paragon.Editor.dll

public class DrawerIndentationAttribute : Attribute

Inheritance: AttributeDrawerIndentationAttribute

Remarks

This attribute provides a declarative way to control how much indentation a custom property drawer applies. Instead of hardcoding indentation values inside each drawer, the drawer reads the Indentation field from this attribute (if present on the class) and uses it to set EditorGUI.indentLevel.

This is particularly useful when the same drawer class is shared across multiple property types that need different visual nesting levels.

Quick Lookup

Goal
How

Set drawer indentation

[DrawerIndentation] class MyDrawer { } then set Indentation = 2

Read from drawer

GetType().GetCustomAttribute<DrawerIndentationAttribute>()?.Indentation ?? 0

Default value

0 (no extra indentation)

Fields

Field
Type
Access
Description

Indentation

int

public

The indentation level to apply. Default is 0.

Examples

Decorating a Drawer

Setting a Custom Indentation Level

Reading the Attribute

See Also

Last updated