ActionSequence
A composite Action that holds an ordered list of child actions and executes them sequentially. Implements IEnumerable<Action> for iteration. Since ActionSequence is itself an Action, sequences can be nested to build complex execution trees.
Definition
Namespace: Paragon.Core.ActionSystem Assembly: Paragon.dll
public class ActionSequence : Action, IEnumerable<Action>Inheritance: Action → ActionSequence Implements: IAction, IEnumerable<Action>
Remarks
ActionSequence uses the Composite pattern — it is both an Action and a container of Action instances. This enables:
Nesting: An
ActionSequencecan contain otherActionSequenceinstances for hierarchical execution.Polymorphism: Each child can be any
Actionsubclass, configured independently in the Inspector.Uniform execution: Callers don't need to know whether they're executing a single action or a sequence.
The child action list is serialized via [OdinSerialize], supporting full polymorphic serialization of each child action and its fields.
Execution model: Actions run strictly sequentially. Each child must complete (or be cancelled) before the next begins. For parallel execution, create a custom Action subclass using Task.WhenAll().
Cancellation propagation: Cancelling a sequence cancels the currently running child via the CancellableTask cancellation token. Child actions using Yield methods will detect cancellation at their next yield point.
Quick Lookup
Execute the sequence
await sequence.ExecuteAsync()
Cancel mid-sequence
sequence.Cancel()
Iterate child actions
foreach (var action in sequence)
Configure children
Use Inspector via Odin polymorphic serialization
Properties
Inherits all properties from Action.
IsRunning
bool
true while any child action is executing
Methods
OnExecute (override)
Executes each child action in order, awaiting completion before starting the next.
If the sequence is cancelled mid-execution, the currently running child action is cancelled via the CancellableTask system, and remaining actions are skipped.
GetEnumerator
Returns an enumerator over the child actions.
Examples
Inspector Configuration
Add an
ActionPlayeror use anActionSequenceas a child in another sequenceSelect
ActionSequencefrom the Odin type dropdownAdd child actions to the list — each can be a different Action subclass
Child actions execute top-to-bottom
Nested Sequences
Iterating Child Actions
See Also
Action — base class this extends
ActionPlayer — MonoBehaviour for playing actions from the Inspector
IAction — interface contract
Last updated