ActionDrawer
Generic Odin property drawer for all Action-derived types. Renders a toolbar header with a polymorphic type selector, a foldable body displaying action variables, and an optional progress indicator that animates while the action is running.
Definition
Namespace: Paragon.Core.ActionSystem.Editor Assembly: Paragon.Editor.dll
[DrawerPriority(0.0, 0.0, 3000.0)]
[DrawerIndentation]
public class ActionDrawer<TAction> : OdinValueDrawer<TAction>
where TAction : ActionInherits: OdinValueDrawer<TAction> (Sirenix.OdinInspector.Editor) Type Constraint: TAction : Action
Remarks
This is the base editor drawer for the entire Action System hierarchy. It handles three responsibilities:
Header — A horizontal toolbar containing a foldout toggle and a
PolymorphicObjectFieldfor type selection. This allows users to pick any concreteActionsubclass from a dropdown.Progress Indicator — An animated bar that pulses while
IsRunningistrue, providing visual feedback during Play Mode.Body — A foldable section that draws the action's
actionVariableschild property (the fields marked with[Variable]).
The drawer uses DrawerPriority(0, 0, 3000) so it takes precedence over Odin's default drawers. Subclass drawers (e.g., ActionSequenceDrawer) use higher priorities to override this drawer for more specific types.
Quick Lookup
Customize the foldout label
Override defaultLabel property
Change header rendering
Override DrawHeader(GUIContent)
Change body rendering
Override DrawBody()
Hide progress indicator
Set showProgressIndicator = false in Initialize()
Check if action is running
Read isRunning property
Properties
defaultLabel
The default GUIContent label shown when no label is provided by the property. Defaults to "Action".
isRunning
Returns whether the drawn action is currently executing. Reads from ValueEntry.SmartValue.IsRunning.
Fields
isExpanded
Controls whether the body foldout is expanded. Defaults to true.
showProgressIndicator
Controls whether the animated progress indicator is shown. Defaults to true. Set to false in Initialize() to hide it.
Methods
DrawPropertyLayout
Main entry point called by Odin. Draws the header, optional progress indicator, and body in a vertical layout.
label
GUIContent
Label from the serialized property. Falls back to defaultLabel if null.
DrawHeader
Draws the toolbar header containing the foldout toggle and polymorphic object field.
label
GUIContent
Label to display. Automatically nicified via ObjectNames.NicifyVariableName().
Behavior:
If
SmartValueisnull: shows a prefix label with no foldout (collapsed).If
SmartValueis set: shows aSirenixEditorGUI.FoldoutcontrollingisExpanded.Always renders
SirenixEditorFields.PolymorphicObjectFieldfor type selection/assignment.
DrawBody
Draws the foldable body containing the action's actionVariables child property.
Behavior:
Wraps content in a
SirenixEditorGUI.BeginFadeGroup/EndFadeGroupcontrolled byisExpanded.Draws the
actionVariableschild property inside a horizontal toolbar with indentation.
Extension Points
Required Overrides
None — ActionDrawer is a concrete class.
Optional Overrides
defaultLabel
Change the default foldout label text
DrawHeader(GUIContent)
Customize the toolbar header (type selector, foldout, extra buttons)
DrawBody()
Customize what is drawn inside the foldable body
Initialize()
One-time setup (e.g., set showProgressIndicator = false)
Implementation Requirements
When subclassing ActionDrawer<TAction>, you MUST:
Use a higher
DrawerPrioritythan3000(otherwise Odin will pick this drawer instead)Constrain
TActionto your custom Action subclass (e.g.,where T : MyAction)
You SHOULD:
Call
base.DrawHeader(label)if you only want to append to the headerCall
base.DrawBody()if you want to extend (not replace) the bodySet
showProgressIndicatorinInitialize(), not inDrawPropertyLayout()
Common Pitfalls
Drawer priority collision If your custom drawer has the same or lower priority than 3000, Odin may still select ActionDrawer instead. Always use a priority above 3000.
Null SmartValue DrawPropertyLayout returns early if SmartValue is null (after drawing the header). Any code in DrawBody() will not execute for unassigned action fields. Do not assume SmartValue is always set.
FadeGroup key uniqueness DrawBody() uses UniqueDrawerKey.Create(actionVariables, this) to generate a unique key for the fade group. If you override DrawBody() and use your own fade groups, ensure unique keys to avoid animation conflicts.
Examples
Custom Drawer for a Specific Action Type
Drawer Without Progress Indicator
See Also
Action — runtime class this drawer renders
ActionSequenceDrawer — subclass that draws ActionSequence
ActionPlayerEditor — custom inspector for ActionPlayer
Action System Editor — editor tooling overview
Last updated