Only if
Conditional keeps a branch admitted while a fact holds, and with Self abort it also takes the branch away when the fact stops holding.
On this page
A Conditional is a gate with the fact written on it. The branch under it runs while the fact succeeds, and the gate is re-read every time the tree comes back to it.
The problem
Section titled “The problem”Chasing is only sensible while the player is visible. A Condition at the front of a Sequence answers that once, at the start of the chase, and then the chase owns the agent until it finishes. If the player ducks behind a crate two seconds in, the enemy keeps running at a wall.
DocumentationDecorators.bqbehavior shows the gate shape as the Conditional called while visible over the chase action. Its name is the promise: the fact is checked for as long as the branch is alive.
When to reach for it
Section titled “When to reach for it”- Work that stays valid only under a condition: chase while visible, hold a door while the player is near, drive the recovery loop while recovery is active.
- A gate that reads better than a Sequence, because the fact belongs to the whole subtree instead of being step one.
- Branch cancellation with Self abort, when the fact turning false should drop the running work immediately.
See it
Section titled “See it”
The fact is true, the Conditional admits the child, and the child runs. The fact goes false and the Conditional reports Failure without the child starting at all.
-
Open
Assets/Platformer/Behavior/DocumentationDecorators.bqbehaviorand select the Conditional called while visible. -
The rail shows condition variable, a dropdown over the graph’s readable declared values. This node reads
player_visible. An unset gate shows the prompt Choose a condition variable…. -
Below it sits abort mode, with two choices: none and self. Leave it on none for a plain gate.
-
Read the Child line. A decorator wraps exactly one child; here it is the chase action.
-
For the running version, open
Assets/Platformer/Behavior/DocumentationReactiveAborts.bqbehavior, which carries the same while visible gate inside a reachable chase branch. Run an agent on it withplayer_visiblefalse: the branch’s sight condition stops the Sequence and the gate is never reached. -
Set
player_visibletrue and the gate admits the chase. That graph’s gate is already on self, so setting the value back to false while the chase is Running drops the chase mid-run instead of letting it finish.

How it decides
Section titled “How it decides”The Conditional evaluates its own fact every time the tree reaches it, then decides whether the child may run.
Result
- Success
- The child ran and returned Success. A Conditional never rewrites its child's result.
- Failure
- The fact did not succeed, so the child was refused. A false blackboard comparison lands here.
- Running
- The fact succeeded and the child is working.
- Admission needs Success. Anything else, including the Blocked that a false blackboard comparison produces, refuses the child and the decorator reports Failure.
- A completed child’s result passes to the Conditional’s parent unchanged. The gate decides whether work happens, never what the work reported.
- abort mode on this node offers none and self. Lower Priority lives on the Selector, because it is about branch priority instead of a single gate.
- With self, the fact is re-evaluated on every update, even while the child is deep in its own work. The moment it stops succeeding, the branch is cancelled, pending work owned by that subtree is cancelled with a Self reason, and the hosting Selector re-decides from its first child.
- self needs an enclosing Selector branch. A Self Conditional with no Selector above it is reported by validation rather than silently ignored.
- A runtime fault while evaluating the fact travels up as a fault. Admission is never guessed from a failed read.
When it goes wrong
Section titled “When it goes wrong”When it goes wrong
| Symptom | Check | Fix |
|---|---|---|
| The child never runs even though the fact looks true. | Read the condition variable dropdown for the prompt or an invalid saved name. | Choose a readable declared value of a comparable type. |
| The branch keeps running after the fact turned false. | Read abort mode on the Conditional. | Set it to self. |
| Validation rejects the Self Conditional. | Look for a Selector above it in the branch. | Put the guarded work in a Selector branch, which is what gives the cancellation somewhere to go. |
| The gate reports Failure and you expected Blocked. | The decorator converts a refused admission into Failure. | Nothing to repair. Read the child Condition in Live for the underlying reason. |
| Chase restarts from the beginning after each cancel. | Self cancellation re-enters the hosting Selector at its first child. | Keep restart-safe work under a Self gate, and keep progress in your own component when a restart would lose it. |
- Interrupt: the full reactive family, with Lower Priority beside Self.
- Flip it: negate a fact instead of gating on it.
- Conditional reference: the rail, field by field.