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
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— theActionVariablesinstance being drawnfieldVariablesProperty—InspectorPropertyfor thefieldVariablesdictionarydynamicVariablesProperty—InspectorPropertyfor thedynamicVariablesdictionarycreateMenu— a new ActionVariableCreateMenu bound to this drawerisExpanded— defaults totrue
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
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
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
Dictionary property indexing
When iterating variable properties, the drawer accesses child.Children[1] to get the value side of each dictionary key-value pair. Index 0 is the key, index 1 is the value. This is an Odin serialization convention for dictionary properties.
Foldout state not persisted
The isExpanded flag defaults to true on each drawer initialization and is not persisted across Inspector reloads or domain reloads.
See Also
ActionVariableDrawer — per-variable drawer used for each item
ActionVariableCreateMenu — popup opened by the + button
ActionVariables — runtime container this drawer visualizes
Action — base class that owns
ActionVariables
Last updated