InteractionTriggerDrawer

Custom Odin Inspector drawer for InteractionTrigger values. Renders polymorphic trigger instances with a foldable header, type-selection field for null values, and indented child properties.

Definition

Namespace: Paragon.Townskeep.InteractionSystem.Editor Assembly: Townskeep.Editor.dll

[DrawerPriority(0.0, 0.0, 3000.0)]
public class InteractionTriggerDrawer : OdinValueDrawer<InteractionTrigger>

Inheritance: OdinValueDrawer<InteractionTrigger>InteractionTriggerDrawer

Remarks

This drawer handles three visual states for an InteractionTrigger property:

  1. Null — Shows a "New Trigger" label with a polymorphic object field for type selection. The foldout is collapsed.

  2. Non-null with children — Shows a foldable header displaying the nicified type name (e.g., "My Custom Trigger" from MyCustomTrigger). Children are drawn indented inside a vertical toolbar.

  3. Non-null without children — Shows the type name as a flat label with no foldout.

The drawer priority is set to 3000.0 on the wrapper layer, ensuring it overrides default Odin drawers for InteractionTrigger.

Quick Lookup

Goal
How

Override trigger rendering

Subclass OdinValueDrawer<YourTriggerType> with higher priority

Access the trigger value

ValueEntry.SmartValue

Access child properties

Property.Children

Methods

DrawPropertyLayout (override)

Main draw method. Renders the trigger inside a vertical toolbar with header and optional children.

Parameter
Type
Description

label

GUIContent

The property label (unused — trigger renders its own header)

DrawHeader (private)

Renders the header bar. Handles null state (polymorphic field), foldout state, and flat label state.

Visual Layout

When null:

Common Pitfalls

circle-exclamation
circle-info

Type name formatting — Uses ObjectNames.NicifyVariableName() to convert PascalCase type names to readable labels (e.g., ProximityTrigger"Proximity Trigger").

See Also

Last updated