Your First Behavior Tree
Build a small behavior tree that writes two messages with a one-second pause between them. This is the shortest project-owned workflow from an empty GameObject to an observable Play Mode result.
Before you begin
- Complete Getting Started and confirm that the editor opens without compiler errors.
- Use a saved scene outside the imported sample folders.
Create the owner
- Create an empty GameObject and name it
FirstBehaviorTree. - Open Tools > Opsive > Behavior Designer > Editor.
- Keep
FirstBehaviorTreeselected in the Hierarchy. - Right-click empty graph space and select Add Behavior Tree. The same command is available from the add button in the operations toolbar.
When the editor first opens without an owner selected, it asks you to select a GameObject. Selecting FirstBehaviorTree replaces this empty state with the GameObject and its graph controls.

Add the Tasks
- Press Space over the graph and add Sequence from Composites.
- Press Space again and add Log from Actions. Repeat so the graph has two Log Tasks.
- Add Wait from Actions.
- Connect the Start event to Sequence.
- Connect the children beneath Sequence from left to right as the first Log, Wait, and second Log.
The Task selector can be searched by name. Clear an active filter if a known Task is missing from the results.

After Sequence is connected to Start, its missing-child error remains visible until at least one valid child is connected.

Sequence runs its children from left to right and stops if a child fails. Both Log Tasks complete immediately; Wait remains Running for its configured duration.
Configure the result
- Select the left Log and set its message to
Behavior tree started. - Select Wait and set its duration to
1second. - Select the right Log and set its message to
Behavior tree finished. - Open the Error Window from the status-bar error count or Tools > Opsive > Behavior Designer > Error Window.
- Resolve every reported missing connection or invalid field.
Selecting a Task displays its fields in the Element Inspector. The gear menu resets the selected Task, while a field’s watch icon shows its live value on the node.

Verify in Play Mode
- Clear the Unity Console.
- Enter Play Mode.
- Keep the graph visible and watch the active highlight move from the first Log to Wait and then the second Log.
- Confirm that the Console shows
Behavior tree started, followed about one second later byBehavior tree finished.
The tree may finish too quickly to see both Log Tasks highlighted, but Wait should visibly report Running during the delay. The Error Window should be clean before Play Mode, and the Console should contain exactly the expected tutorial messages with no new exceptions.
Make one controlled change
Change Wait to three seconds and test again. The message order should remain the same while the visible Running interval becomes longer. This verifies that the graph you edited, rather than a sample or another component, owns the runtime result.
Troubleshooting
| Symptom | Check | Fix |
|---|---|---|
| The editor shows no graph. | Confirm that FirstBehaviorTree is selected and owns a Behavior Tree component. |
Select it from the operations toolbar or add the component again. |
| Sequence reports an error. | Check its Start connection and three child connections. | Connect Start to Sequence and order the children left to right. |
| The Console remains empty. | Check whether Play Mode is running, the component is enabled, and the first Log is enabled. | Enable the GameObject, component, and Tasks, then enter Play Mode again. |
| The second message appears immediately. | Check the Wait duration and child order. | Set Wait to 1 or more and place it between the Log Tasks. |
| A Task cannot be found. | Look for active selector filters or compiler errors. | Clear filters and resolve Console errors before reopening the selector. |
For additional diagnostics, use Debugging.
Continue learning
- Read Flow to understand why Sequence continues after success and stops after failure.
- Build Patrol and Chase an Enemy to add a real decision and fallback.
- Use Variables when two Tasks need the same target or value.
- Use Subtrees when a complete branch should be shared by several agents.