ActionVariablesDrawer

Custom Odin Inspector drawer for the ActionVariables container. Renders a collapsible "Variables" section in the Inspector with a header, foldout, create button, and lists of field and dynamic variables.

Definition

Namespace: Paragon.Core.ActionSystem.Editor Assembly: Paragon.Editor.dll

[DrawerPriority(0.0, 0.0, 3000.0)]
public class ActionVariablesDrawer : OdinValueDrawer<ActionVariables>

Inherits: OdinValueDrawer<ActionVariables>

Remarks

This is the root drawer for the Action Variable system in the Inspector. Every Action subclass that contains an ActionVariables field will have this drawer render the variable management UI. It delegates individual variable rendering to ActionVariableDrawer.

The drawer separates variables into two groups:

  • Field variables — discovered via reflection from [Variable]-attributed fields on the Action class. Always appear first.

  • Dynamic variables — created at edit-time via the ActionVariableCreateMenu. Appear below field variables, separated by a horizontal rule.

The drawer priority is set to 3000.0 (wrapper priority) to ensure it takes precedence over default drawers.

Quick Lookup

Goal
How

Add a dynamic variable

Click the + button in the "Variables" header

Expand/collapse variables

Click the foldout arrow (only visible when variables exist)

Remove a dynamic variable

Click the trash icon on the individual variable (handled by ActionVariableDrawer)

Lifecycle

Initialize

Called once when the drawer is first created. Sets up:

  • actionVariables — the ActionVariables instance being drawn

  • fieldVariablesPropertyInspectorProperty for the fieldVariables dictionary

  • dynamicVariablesPropertyInspectorProperty for the dynamicVariables dictionary

  • createMenu — a new ActionVariableCreateMenu bound to this drawer

  • isExpanded — defaults to true

DrawPropertyLayout

Main draw method called every Inspector GUI frame. Renders the full variable section.

Layout Structure

Drawing Methods

DrawHeader

Renders the "Variables" header toolbar:

  • If variables exist: shows a foldout toggle for expand/collapse

  • If no variables exist: shows a static "Variables" label (collapsed, non-interactive)

  • Always shows a + button (Odin SdfIconType.Plus) that opens the ActionVariableCreateMenu

DrawVariables

Parameter
Type
Description

variablesProperty

InspectorProperty

Either fieldVariablesProperty or dynamicVariablesProperty

Iterates over all children of the given dictionary property and draws each ActionVariable using its name as the label. Each child is accessed via child.Children[1] (the dictionary value, index 1 in a key-value pair property).

Visual Behavior

Condition
Foldout State

Has field or dynamic variables

Foldout visible, defaults expanded

No variables at all

Foldout hidden, label only

Field variables only

No separator, field list only

Dynamic variables only

No separator, dynamic list only

Both field and dynamic

Horizontal separator between groups

Common Pitfalls

circle-exclamation
circle-exclamation

See Also

Last updated