Behavior Tree Component
The Behavior Tree component owns one tree on a GameObject and provides the runtime API for starting, pausing, stopping, querying, and replacing it.

Configure the component
| Setting | Result |
|---|---|
| Behavior Name / Description | Identifies the tree in the editor and runtime diagnostics. |
| External Behavior | Runs the assigned External Behavior Tree through this component. |
| Group | Supplies an integer grouping for project code that finds related behaviors. |
| Start When Enabled | Starts the tree when the component becomes enabled. Disable it when another system controls startup. |
| Asynchronous Load | Deserializes behavior data on a worker thread. Do not use it when property mappings require Unity API access during load. |
| Pause When Disabled | Pauses at the current execution point instead of ending when the component is disabled. |
| Restart When Complete | Starts again after the root returns Success or Failure. |
| Reset Values On Restart | Restores task fields and variables to their authored values before restarting. |
| Log Task Changes | Writes task stack changes to the Console for detailed debugging. |
Control execution from code
using BehaviorDesigner.Runtime;
public class BehaviorControl : UnityEngine.MonoBehaviour
{
private BehaviorTree m_Tree;
private void Awake()
{
m_Tree = GetComponent<BehaviorTree>();
}
public void StartTree() => m_Tree.EnableBehavior();
public void PauseTree() => m_Tree.DisableBehavior(true);
public void StopTree() => m_Tree.DisableBehavior(false);
}
ExecutionStatus is Running while the tree is active and becomes Success or Failure when it finishes. Subscribe to OnBehaviorStart, OnBehaviorRestart, or OnBehaviorEnd when another system needs lifecycle notification.
Find tasks
var firstWait = behaviorTree.FindTask<BehaviorDesigner.Runtime.Tasks.Wait>();
var allWaits = behaviorTree.FindTasks<BehaviorDesigner.Runtime.Tasks.Wait>();
var namedTask = behaviorTree.FindTaskWithName("Approach Target");
var namedTasks = behaviorTree.FindTasksWithName("Approach Target");
Task references are tied to the current deserialized tree. Reacquire them after replacing an External Behavior Tree or otherwise rebuilding the behavior data.
Use Create a Behavior Tree from Script for a runtime-created owner, and Behavior Manager for project-wide ticking.