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 : OdinEditor

Inherits: 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's Execute() method. Behavior depends on the action implementation (most async actions require Play Mode).

Quick Lookup

Goal
How

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 tree

  • Returns early if HasAction is false (no buttons shown)

  • Renders Play and Stop buttons centered via FlexibleSpace(true, true) with 25px spacing

Extension Points

Optional Overrides

Method
Purpose

OnInspectorGUI()

Replace or extend the entire inspector layout

Implementation Requirements

When subclassing ActionPlayerEditor, you MUST:

  1. Apply [CustomEditor(typeof(YourActionPlayerSubclass))] to target your specific type

  2. Call base.OnInspectorGUI() if you want to keep the default Play/Stop buttons

You SHOULD:

  • Use DrawGUI utilities for consistent visual styling

  • Check HasAction before adding action-dependent controls

Common Pitfalls

circle-exclamation
circle-exclamation

Examples

Extended ActionPlayer Inspector

See Also

Last updated