UBehaviorTree
#include "BehaviorTree/BehaviorTree.h" Description
A data asset that defines an AI's decision-making logic as a tree of composites, tasks, decorators, and services. Executed at runtime by a UBehaviorTreeComponent.
Caveats & Gotchas
- • UBehaviorTree is a data asset authored in the editor — you do not construct or modify it at runtime from C++.
- • The Blackboard asset associated with the tree is set in the editor. RunBehaviorTree() will initialize it automatically.
- • Subtrees are supported via the Run Behavior task node, allowing reusable logic to be shared across trees.
Example
Reference a behavior tree in an AIController C++
UPROPERTY(EditDefaultsOnly, Category="AI")
UBehaviorTree* PatrolTree;
// In OnPossess:
RunBehaviorTree(PatrolTree); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?