ActionPlayerEditor
Custom Odin inspector for ActionPlayer. Extends the default inspector by appending Play and Stop buttons, enabling designers to trigger action playback directly from the Inspector.
Definition
Namespace: Paragon.Core.ActionSystem.Editor Assembly: Paragon.Editor.dll
[CustomEditor(typeof(ActionPlayer))]
public class ActionPlayerEditor : OdinEditorInherits: OdinEditor (Sirenix.OdinInspector.Editor) Target: ActionPlayer
Remarks
This editor draws the full Odin property tree (which includes the Action field rendered by ActionDrawer), then conditionally appends a horizontal toolbar with Play and Stop buttons. The buttons only appear when ActionPlayer.HasAction is true (i.e., an action is assigned).
The buttons call ActionPlayer.Play() and ActionPlayer.Stop() directly, which means:
In Play Mode: Actions execute normally with full async lifecycle.
In Edit Mode:
Play()fires the action'sExecute()method. Behavior depends on the action implementation (most async actions require Play Mode).
Quick Lookup
Add custom buttons to ActionPlayer inspector
Override OnInspectorGUI() in a subclass
Change button width
Modify GUILayoutOptions.Width(100)
Add buttons for other actions
Follow the same pattern with DrawGUI.Button()
Methods
OnInspectorGUI
Draws the full property tree followed by Play/Stop buttons (if an action is assigned).
Layout Structure:
Behavior:
Draws
Tree.Draw()for the full Odin property treeReturns early if
HasActionisfalse(no buttons shown)Renders Play and Stop buttons centered via
FlexibleSpace(true, true)with 25px spacing
Extension Points
Optional Overrides
OnInspectorGUI()
Replace or extend the entire inspector layout
Implementation Requirements
When subclassing ActionPlayerEditor, you MUST:
Apply
[CustomEditor(typeof(YourActionPlayerSubclass))]to target your specific typeCall
base.OnInspectorGUI()if you want to keep the default Play/Stop buttons
You SHOULD:
Use
DrawGUIutilities for consistent visual stylingCheck
HasActionbefore adding action-dependent controls
Common Pitfalls
Play in Edit Mode Clicking Play in Edit Mode calls ActionPlayer.Play(), which invokes Action.Execute(). Async actions using Yield.WaitForUpdate() or similar will not work correctly outside Play Mode since Unity's update loop is not running.
CustomEditor inheritance Unity's [CustomEditor] attribute does not automatically propagate to subclasses of ActionPlayer. If you subclass ActionPlayer, you need a separate [CustomEditor(typeof(MyActionPlayer))] editor or use [CustomEditor(typeof(ActionPlayer), true)] with the editorForChildClasses parameter.
Examples
Extended ActionPlayer Inspector
See Also
ActionPlayer — runtime MonoBehaviour this editor targets
ActionDrawer — drawer that renders the Action field inside the inspector
Action System Editor — editor tooling overview
Last updated