Sequence

Execute child nodes in order. Fails if any child fails. Like a logical AND operation.

Introduction

A Sequence tries its children in order. All children must succeed for the Sequence to succeed. If any child fails, the entire Sequence fails immediately.

Think of it like the logical AND operator (&&) in code:

Sequence("Task") → A() && B() && C()
Sequence("Task") → A() && B() && C()

All must succeed for the sequence to succeed.

Usage

Children are executed in the order they appear.

Sequence("Move To", () =>
{
    // Must complete in order
    NavigateToTarget();
    Wait(1f);
    Celebrate();

    // If any fails, sequence fails
});
Sequence("Move To", () =>
{
    // Must complete in order
    NavigateToTarget();
    Wait(1f);
    Celebrate();

    // If any fails, sequence fails
});

Next: Selector

Learn about Selector nodes that try children until one succeeds.

Read about Selector →