A conditional abort lets a running tree react to a change in a Conditional Task without reevaluating the whole tree each tick. The equivalent feature in Unreal Engine is the Observer Abort.

How an abort interrupts a running branch

Can See Object has failed and the Selector is running its lower-priority Idle branch.

Can See Object returns Failure because no object is in sight, so Selector runs its next child, Idle.

Can See Object is marked for reevaluation while the lower-priority Idle branch runs.

While Idle runs, the object comes into sight and Can See Object changes to Success. With a conditional abort configured, Can See Object issues the abort, stops Idle, and traversal resumes normally from the reevaluated Conditional — here into Seek.

Can See Object has changed to Success and interrupted the lower-priority Idle branch.

Choose an abort type

Set Abort Type on the Composite that parents the Conditional. The available values are:

Abort Type Reevaluates while Use it when
None Never. The Conditional is evaluated only when traversal reaches it. The branch should run to completion once it is entered.
Lower Priority Any Task to the right of the current branch is active. The tree is ordered by priority and a higher-priority Conditional should preempt lower-priority work.
Self Any Task within the current branch is active. The branch should stop itself when its own entry condition stops holding.
Both Any Task to the right of or within the current branch is active. The branch should both preempt lower-priority work and stop itself.

A Sequence inspector has its Abort Type set to Lower Priority.

A Sequence inspector has its Abort Type set to Both.

Two constraints apply to every abort type:

  • Conditional aborts reevaluate Conditional Tasks only. An Action Task is never reevaluated by this system.
  • An abort triggers when the Conditional changes status in either direction — Failure to Success, or Success to Failure.

Reevaluation is not free: each reevaluated Conditional runs on every tick that its abort scope is active. Performance covers the cost model and how Evaluation Type bounds the work performed per tick.

Order a priority tree

A common structure alternates Selector and Sequence nodes, with the highest-priority branch on the far left and decreasing priority to the right. Lower Priority aborts then keep the higher-priority Conditionals live.

Alternating Selector and Sequence branches place the highest-priority condition on the left.

In this tree Has Taken Damage has the highest priority and is reevaluated whenever any branch to its right is active, which is set by the Lower Priority abort on its Sequence. If the agent has not taken damage, Can See Object is reevaluated while the Within Distance or Patrol branches run. Within Distance is in turn reevaluated for as long as Patrol is active.

A Conditional that is currently being reevaluated draws a circle around the execution-status icon in the upper right of the node:

Two conditions are marked for reevaluation above a running lower-priority branch.

Nest aborts for either-or conditions

Aborts can be nested to run a branch when either of two Conditionals succeeds. Parent Has Taken Damage and Within Distance to a Selector with the Lower Priority abort type, then make the Action a sibling of that Selector under a Sequence. Set the Sequence to Lower Priority so both Conditionals continue to be reevaluated while an unrelated branch runs.

Two Conditional branches can independently interrupt the lower-priority Action.

To require that both Conditionals succeed before lower-priority branches abort, place them inside a Stacked Conditional with a Sequence comparison type:

A Stacked Conditional requires both contained conditions before interrupting the lower-priority branch.

Run logic when an interrupt occurs

The On Interrupt Event Task runs a branch when an interrupt happens. Adding it to the first example gives:

An On Interrupt event branch runs Log when a Conditional Abort stops Idle.

On Interrupt specifies the Idle Task, so Log runs when the conditional abort system interrupts Idle.

See conditional aborts in a complete tree

Patrol and Chase an Enemy uses Both aborts to leave Patrol when an enemy becomes visible and to leave Chase when visibility is lost. Flee at Low Health shows a higher-priority survival branch interrupting ordinary combat.