RealDocs

UBehaviorTreeComponent

class AIModule Since 4.0
#include "BehaviorTree/BehaviorTreeComponent.h"

Description

The runtime component that executes a UBehaviorTree asset. Owned by AAIController and responsible for ticking the tree, managing active tasks, and handling aborts.

Caveats & Gotchas

  • You typically do not interact with UBehaviorTreeComponent directly — use AAIController::RunBehaviorTree() and the Blackboard API instead.
  • Accessed via AAIController::GetBrainComponent() cast to UBehaviorTreeComponent if you need low-level control.
  • Stopping the component mid-execution (StopTree()) will abort the active task and clean up the active branch.

Example

Stop a running behavior tree C++
if (UBehaviorTreeComponent* BTC = Cast<UBehaviorTreeComponent>(GetBrainComponent()))
{
    BTC->StopTree();
}

Tags

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.