RealDocs

UBehaviorTreeComponent::StopTree

function AIModule Since 4.0
#include "BehaviorTree/BehaviorTreeComponent.h"
Access: public

Description

Stops execution of the currently running tree, aborting the active task and clearing all tree instances.

Caveats & Gotchas

  • EBTStopMode::Safe (the default) waits for latent aborts to complete, so the component may still report IsRunning() true for a frame or two after calling this.
  • Called automatically by UninitializeComponent, so you rarely need to call it directly except to explicitly halt AI logic while keeping the component alive.

Signature

void StopTree(EBTStopMode::Type StopMode = EBTStopMode::Safe);

Parameters

Name Type Description Default
StopMode EBTStopMode::Type Safe waits for the active task to finish aborting before tearing down; Forced tears down immediately without waiting. EBTStopMode::Safe

Return Type

void

Example

Stop the tree safely C++
BTComp->StopTree(EBTStopMode::Safe);

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.