RealDocs

UBehaviorTreeComponent::RequestExecution

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

Description

Low-level entry point for triggering a new execution search from a specific composite node. Most code should use the RequestBranchEvaluation/RequestBranchActivation/RequestBranchDeactivation helpers, which call into this with the correct parameters for tasks and decorators.

Caveats & Gotchas

  • Two simpler inline overloads exist (taking just a UBTDecorator* or an EBTNodeResult::Type) but both are thin wrappers around RequestBranchEvaluation — prefer calling that directly instead of this overload's siblings.
  • Passing the wrong InstanceIdx / RequestedByChildIndex pair can cause the search to evaluate the wrong subtree; these values normally come from bookkeeping the calling node already has, not values you compute by hand.

Signature

void RequestExecution(const UBTCompositeNode* RequestedOn, const int32 InstanceIdx, const UBTNode* RequestedBy, const int32 RequestedByChildIndex, const EBTNodeResult::Type ContinueWithResult, bool bStoreForDebugger = true);

Parameters

Name Type Description Default
RequestedOn const UBTCompositeNode* Composite node the execution search is evaluated against.
InstanceIdx const int32 Index of the tree instance (subtree) the request applies to.
RequestedBy const UBTNode* Node that triggered the request (task or decorator).
RequestedByChildIndex const int32 Child index under RequestedOn that RequestedBy corresponds to.
ContinueWithResult const EBTNodeResult::Type Result to resume with if the request ends up continuing the previous branch instead of switching to a new one.
bStoreForDebugger bool Whether to record this request in the behavior tree debugger's search log. true

Return Type

void

Example

Direct low-level request (as used internally by RequestBranchEvaluation) C++
OwnerComp.RequestExecution(RequestedOn, InstanceIdx, RequestedBy, RequestedByChildIndex, ContinueWithResult, /*bStoreForDebugger=*/true);

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.