RealDocs

UBehaviorTreeComponent::RestartTree

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

Description

Restarts execution from the root node of the currently running tree, either by re-evaluating in place or by fully stopping and starting it again.

Caveats & Gotchas

  • The default ForceReevaluateRootNode mode keeps nodes that remain active between the old and new search alive, so they don't get CeaseRelevant/BecomeRelevant callbacks — use CompleteRestart if you need every node to fully reset.
  • Has no effect if no tree is currently running; it doesn't start a tree on its own.

Signature

void RestartTree(EBTRestartMode RestartMode = EBTRestartMode::ForceReevaluateRootNode);

Parameters

Name Type Description Default
RestartMode EBTRestartMode ForceReevaluateRootNode re-requests execution from the root without notifying nodes that stay active as CeaseRelevant/BecomeRelevant; CompleteRestart tears down and restarts from scratch, equivalent to StopTree then StartTree. EBTRestartMode::ForceReevaluateRootNode

Return Type

void

Example

Force a full restart C++
BTComp->RestartTree(EBTRestartMode::CompleteRestart);

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.