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: ActionActionSequence 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 ActionSequence can contain other ActionSequence instances for hierarchical execution.

  • Polymorphism: Each child can be any Action subclass, 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.

circle-info

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().

circle-exclamation

Quick Lookup

Goal
How

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.

Property
Type
Description

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

  1. Add an ActionPlayer or use an ActionSequence as a child in another sequence

  2. Select ActionSequence from the Odin type dropdown

  3. Add child actions to the list — each can be a different Action subclass

  4. 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