BTSelector

Inherits: BTComposite < BTTask < BT

BT composite that sequentially executes tasks until first SUCCESS.

Description

BTSelector executes its child tasks sequentially, from first to last, until any child returns SUCCESS. If a child task results in FAILURE, BTSelector will immediately execute the next child task until one of them returns SUCCESS or all of them result in FAILURE. BTSelector and BTSequence are two of the most common building blocks of behavior trees. Essentially, while BTSequence is similar to a boolean AND operation, BTSelector is similar to a boolean OR operation. Selectors enable the behavior tree to respond to changes in the environment and trigger transitions between various fallback behaviors.

Returns RUNNING if a child task results in RUNNING. BTSelector will remember the last child task that returned RUNNING, ensuring it resumes from that point in the next execution tick.

Returns SUCCESS if a child task results in SUCCESS.

Returns FAILURE if all child tasks result in FAILURE.