ActionVariableDrawer
Custom Odin Inspector drawer for individual ActionVariable instances. Renders either an inline value editor or a reference label depending on the variable's mode, and provides toggle and delete controls.
Definition
Namespace: Paragon.Core.ActionSystem.Editor
Assembly: Paragon.Editor.dll
[DrawerPriority(0.0, 0.0, 3000.0)]
public class ActionVariableDrawer : OdinValueDrawer<ActionVariable>Inherits: OdinValueDrawer<ActionVariable>
Remarks
This drawer is automatically resolved by Odin for any ActionVariable property in the Inspector. It renders each variable in a toolbar-style row with three sections:
Value area — either an inline property field (direct value mode) or a styled reference label with dropdown (reference mode).
Link toggle — a toggle button that switches between direct-value and reference modes, calling
ActionVariable.IsReferenceand clearing the unused binding.Delete button — removes the variable from its parent
ActionVariablescontainer, but only for dynamic variables (field variables are non-removable).
The drawer priority is set to 3000.0 (wrapper priority) to ensure it takes precedence over default drawers.
Quick Lookup
Toggle reference mode
Click the link icon button (cyan = reference, gray = direct value)
Select a reference
Click the dropdown arrow in reference mode → opens ActionVariableReferenceMenu
Delete a variable
Click the trash icon (only enabled for dynamic variables)
Lifecycle
Initialize
Called once when the drawer is first created. Sets up:
variable— theActionVariablebeing drawnvalueProperty— the childInspectorPropertyfor the variable'sValuefieldisRemovable—trueonly if the variable is not a field variable (!variable.IsFieldVariable)referenceMenu— a new ActionVariableReferenceMenu instance bound to this drawer
DrawPropertyLayout
Main draw method called every Inspector GUI frame. The label text is nicified via ObjectNames.NicifyVariableName() before rendering.
Drawing Modes
Direct Value Mode (IsReference == false)
IsReference == false)Renders the variable's Value property using Odin's standard property drawing. Respects the current drawer indentation level.
Reference Mode (IsReference == true)
IsReference == true)Renders a cyan-colored box showing:
The referenced variable's nicified name (or "No Variable Selected" if unbound)
A dropdown arrow button that opens the ActionVariableReferenceMenu
Controls
Link Toggle
A toggle button with a link icon that switches between direct-value and reference modes.
Direct value mode
Gray link icon
Reference mode
Cyan link icon
When toggled:
Marks the serialization root dirty for undo/save
Sets
variable.IsReferenceto the new valueClears the unused binding: reference mode clears the direct value (
SetValue(default)), direct mode clears the reference (SetReference(default))
Delete Button
A red trash icon button that removes the variable from its parent ActionVariables container.
Dynamic variable
Red trash icon (enabled)
Calls ActionVariables.RemoveVariable(variable.Name)
Field variable
Gray trash icon (read-only)
Button is disabled
The delete operation walks up the property tree to find the parent actionVariables property and calls RemoveVariable() on it.
Common Pitfalls
Field variables cannot be deleted
Variables discovered via the [Variable] attribute on Action fields are permanent. The delete button is intentionally disabled for these. Only dynamically added variables can be removed.
Reference clears value, and vice versa
Toggling between reference and direct-value modes resets the other binding. Switching to reference mode calls SetValue(default), and switching back calls SetReference(default). Values are not preserved across mode switches.
See Also
ActionVariablesDrawer — parent drawer that renders the variable list
ActionVariableReferenceMenu — popup for selecting variable references
ActionVariable — the runtime class this drawer visualizes
Last updated