Follow traversal

A behavior tree is traversed from top to bottom and left to right. Every task returns Running, Success, or Failure, and that status determines which task is reached next.

Compare Sequence and Selector

Sequence runs its children from left to right and continues only while each child succeeds. The first Failure stops the Sequence. Use it for ordered prerequisites and work.

Selector also considers its children from left to right, but it stops on the first Success and moves right after Failure. Use it for priorities and fallbacks.

In Play Mode the Entry and Selector are running on the active path, the sensing Sequence has failed, and the fallback Idle task is running.

In this tree the sensing Sequence failed, so the Selector moved to the fallback Idle Action. The running highlight shows the active path without changing the traversal rule.

Gate work with a Conditional

Place a Conditional before an Action in a Sequence. If the Conditional fails, the Sequence fails before the Action starts. If it succeeds, traversal continues into the Action.

Conditionals normally run only when traversal reaches them. Use Conditional Aborts when an important condition must be reevaluated while another branch is Running.

Change one child with a Decorator

A Decorator has one child and changes its execution or reported result. Inverter swaps Success and Failure, Repeater restarts its child, and Cooldown temporarily prevents another execution.

Run branches together

Parallel and Parallel Selector start several children during the same traversal. Choose the completion rule carefully: Parallel is appropriate when the branches belong together, while Parallel Selector is useful when the first successful branch should end a race.

Continue