Build a small reactive tree that seeks a visible target and otherwise idles. The result demonstrates Selector fallback, Sequence ordering, task status, and a Lower Priority conditional abort.

Before you begin

Import Behavior Designer without Console errors and open a working copy of Assets/Behavior Designer/Tutorial/BehaviorTree.unity. The base product includes Can See Object and Seek in the Tutorial category; this tutorial does not require Movement Pack. Keep the scene’s NavMesh and agent navigation components available.

Build the fallback tree

  1. Select the agent and open its Behavior Tree component.
  2. Add a Selector below Entry.
  3. Add a Sequence as the Selector’s left child and Idle as its right child.
  4. From the Tutorial category, add Can See Object and then Seek below the Sequence.
  5. In Can See Object, assign the enemy to Target Object and choose a field of view and distance that include it during the test.
  6. In Seek, assign the same enemy to Target and set Arrive Distance to at least the NavMeshAgent‘s Stopping Distance.

A Selector behavior tree checks Can See Object and seeks its target, otherwise falling back to Idle.

The Selector tries the left branch first. If Can See Object fails, its Sequence fails and the Selector starts Idle. If the condition succeeds, Seek runs until it reaches the target and returns Success.

Make the tree reactive

Select the Sequence and set Abort Type to Lower Priority. While Idle is active, Behavior Designer now reevaluates the higher-priority Can See Object condition. When that result changes from Failure to Success, the tree aborts Idle and starts Seek.

Verify in Play Mode

Enter Play Mode with the target initially outside the field of view. The condition and Sequence show Failure while Idle is green. Move the target into view; the condition should reevaluate, Idle should stop, and Seek should become active.

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.

If Idle never stops, confirm that the Sequence uses Lower Priority, that Can See Object is the left-most condition, and that the target is within View Distance and Field Of View Angle. The tutorial condition also requires a linecast to hit the target or its hierarchy without an intervening obstruction; it has no configurable layer-mask field.

Continue with Conditional Aborts for Self, Lower Priority, Both, and nested reevaluation.