UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FBehaviorTreeInstance Struct Reference

#include <BehaviorTreeTypes.h>

Public Member Functions

AIMODULE_API FBehaviorTreeInstance ()
 
AIMODULE_API FBehaviorTreeInstance (const FBehaviorTreeInstance &Other)
 
FBehaviorTreeInstanceoperator= (const FBehaviorTreeInstance &Other)=default
 
AIMODULE_API FBehaviorTreeInstance (FBehaviorTreeInstance &&Other)
 
AIMODULE_API FBehaviorTreeInstanceoperator= (FBehaviorTreeInstance &&Other)
 
AIMODULE_API FBehaviorTreeInstance (int32 MemorySize)
 
AIMODULE_API ~FBehaviorTreeInstance ()
 
uint32 GetAllocatedSize () const
 
void IncMemoryStats () const
 
void DecMemoryStats () const
 
void Initialize (UBehaviorTreeComponent &OwnerComp, UBTCompositeNode &Node, int32 &InstancedIndex, EBTMemoryInit::Type InitType)
 
void Cleanup (UBehaviorTreeComponent &OwnerComp, EBTMemoryClear::Type CleanupType)
 
bool HasActiveNode (uint16 TestExecutionIndex) const
 
void DeactivateNodes (FBehaviorTreeSearchData &SearchData, uint16 InstanceIndex)
 
TArrayView< UBTAuxiliaryNode *const > GetActiveAuxNodes () const
 
void AddToActiveAuxNodes (UBTAuxiliaryNode *AuxNode)
 
void AddToActiveAuxNodes (UBehaviorTreeComponent &OwnerComp, UBTAuxiliaryNode *AuxNode)
 
void RemoveFromActiveAuxNodes (UBTAuxiliaryNode *AuxNode)
 
void RemoveFromActiveAuxNodes (UBehaviorTreeComponent &OwnerComp, UBTAuxiliaryNode *AuxNode)
 
void ResetActiveAuxNodes ()
 
void ExecuteOnEachAuxNode (TFunctionRef< void(const UBTAuxiliaryNode &)> ExecFunc)
 
TArrayView< const FBehaviorTreeParallelTaskGetParallelTasks () const
 
void AddToParallelTasks (FBehaviorTreeParallelTask &&ParallelTask)
 
void RemoveParallelTaskAt (int32 TaskIndex)
 
void MarkParallelTaskAsAbortingAt (int32 TaskIndex)
 
bool IsValidParallelTaskIndex (const int32 Index) const
 
void ExecuteOnEachParallelTask (TFunctionRef< void(const FBehaviorTreeParallelTask &, const int32)> ExecFunc)
 
void SetInstanceMemory (const TArray< uint8 > &Memory)
 
TArrayView< const uint8GetInstanceMemory () const
 

Public Attributes

TObjectPtr< UBTCompositeNodeRootNode
 
TObjectPtr< UBTNodeActiveNode
 
TArray< TObjectPtr< UBTAuxiliaryNode > > ActiveAuxNodes
 
TArray< FBehaviorTreeParallelTaskParallelTasks
 
TArray< uint8InstanceMemory
 
uint8 InstanceIdIndex
 
TEnumAsByte< EBTActiveNode::TypeActiveNodeType
 
FBTInstanceDeactivation DeactivationNotify
 

Protected Member Functions

void CleanupNodes (UBehaviorTreeComponent &OwnerComp, UBTCompositeNode &Node, EBTMemoryClear::Type CleanupType)
 

Detailed Description

data required for instance of single subtree

Constructor & Destructor Documentation

◆ FBehaviorTreeInstance() [1/4]

FBehaviorTreeInstance::FBehaviorTreeInstance ( )

◆ FBehaviorTreeInstance() [2/4]

FBehaviorTreeInstance::FBehaviorTreeInstance ( const FBehaviorTreeInstance Other)

◆ FBehaviorTreeInstance() [3/4]

FBehaviorTreeInstance::FBehaviorTreeInstance ( FBehaviorTreeInstance &&  Other)

◆ FBehaviorTreeInstance() [4/4]

FBehaviorTreeInstance::FBehaviorTreeInstance ( int32  MemorySize)

◆ ~FBehaviorTreeInstance()

FBehaviorTreeInstance::~FBehaviorTreeInstance ( )

Member Function Documentation

◆ AddToActiveAuxNodes() [1/2]

void FBehaviorTreeInstance::AddToActiveAuxNodes ( UBehaviorTreeComponent OwnerComp,
UBTAuxiliaryNode AuxNode 
)

add specified node to the active nodes list

◆ AddToActiveAuxNodes() [2/2]

void FBehaviorTreeInstance::AddToActiveAuxNodes ( UBTAuxiliaryNode AuxNode)

◆ AddToParallelTasks()

void FBehaviorTreeInstance::AddToParallelTasks ( FBehaviorTreeParallelTask &&  ParallelTask)

add new parallel task

◆ Cleanup()

void FBehaviorTreeInstance::Cleanup ( UBehaviorTreeComponent OwnerComp,
EBTMemoryClear::Type  CleanupType 
)

cleanup node instances

◆ CleanupNodes()

void FBehaviorTreeInstance::CleanupNodes ( UBehaviorTreeComponent OwnerComp,
UBTCompositeNode Node,
EBTMemoryClear::Type  CleanupType 
)
protected

worker for updating all nodes

◆ DeactivateNodes()

void FBehaviorTreeInstance::DeactivateNodes ( FBehaviorTreeSearchData SearchData,
uint16  InstanceIndex 
)

deactivate all active aux nodes and remove their requests from SearchData

◆ DecMemoryStats()

void FBehaviorTreeInstance::DecMemoryStats ( ) const
inline

◆ ExecuteOnEachAuxNode()

void FBehaviorTreeInstance::ExecuteOnEachAuxNode ( TFunctionRef< void(const UBTAuxiliaryNode &)>  ExecFunc)

iterate on auxiliary nodes and call ExecFunc on each of them. Nodes can not be added or removed during the iteration

◆ ExecuteOnEachParallelTask()

void FBehaviorTreeInstance::ExecuteOnEachParallelTask ( TFunctionRef< void(const FBehaviorTreeParallelTask &, const int32)>  ExecFunc)

iterate on parallel tasks and call ExecFunc on each of them. Supports removing the iterated task while processed

◆ GetActiveAuxNodes()

TArrayView< UBTAuxiliaryNode *const > FBehaviorTreeInstance::GetActiveAuxNodes ( ) const
inline

get list of all active auxiliary nodes

◆ GetAllocatedSize()

uint32 FBehaviorTreeInstance::GetAllocatedSize ( ) const
inline

◆ GetInstanceMemory()

TArrayView< const uint8 > FBehaviorTreeInstance::GetInstanceMemory ( ) const
inline

get instance memory

◆ GetParallelTasks()

TArrayView< const FBehaviorTreeParallelTask > FBehaviorTreeInstance::GetParallelTasks ( ) const
inline

get list of all active parallel tasks

◆ HasActiveNode()

bool FBehaviorTreeInstance::HasActiveNode ( uint16  TestExecutionIndex) const

check if instance has active node with given execution index

◆ IncMemoryStats()

void FBehaviorTreeInstance::IncMemoryStats ( ) const
inline

◆ Initialize()

void FBehaviorTreeInstance::Initialize ( UBehaviorTreeComponent OwnerComp,
UBTCompositeNode Node,
int32 InstancedIndex,
EBTMemoryInit::Type  InitType 
)

initialize memory and create node instances

◆ IsValidParallelTaskIndex()

bool FBehaviorTreeInstance::IsValidParallelTaskIndex ( const int32  Index) const
inline

indicates if the provided index is a valid parallel task index

◆ MarkParallelTaskAsAbortingAt()

void FBehaviorTreeInstance::MarkParallelTaskAsAbortingAt ( int32  TaskIndex)

mark parallel task at given index as pending abort

◆ operator=() [1/2]

FBehaviorTreeInstance & FBehaviorTreeInstance::operator= ( const FBehaviorTreeInstance Other)
default

◆ operator=() [2/2]

FBehaviorTreeInstance & FBehaviorTreeInstance::operator= ( FBehaviorTreeInstance &&  Other)

◆ RemoveFromActiveAuxNodes() [1/2]

void FBehaviorTreeInstance::RemoveFromActiveAuxNodes ( UBehaviorTreeComponent OwnerComp,
UBTAuxiliaryNode AuxNode 
)

remove specified node from the active nodes list

◆ RemoveFromActiveAuxNodes() [2/2]

void FBehaviorTreeInstance::RemoveFromActiveAuxNodes ( UBTAuxiliaryNode AuxNode)

◆ RemoveParallelTaskAt()

void FBehaviorTreeInstance::RemoveParallelTaskAt ( int32  TaskIndex)

remove parallel task at given index

◆ ResetActiveAuxNodes()

void FBehaviorTreeInstance::ResetActiveAuxNodes ( )

remove all auxiliary nodes from active nodes list

◆ SetInstanceMemory()

void FBehaviorTreeInstance::SetInstanceMemory ( const TArray< uint8 > &  Memory)

set instance memory

Member Data Documentation

◆ ActiveAuxNodes

TArray<TObjectPtr<UBTAuxiliaryNode> > FBehaviorTreeInstance::ActiveAuxNodes

active auxiliary nodes

◆ ActiveNode

TObjectPtr<UBTNode> FBehaviorTreeInstance::ActiveNode

active node in template

◆ ActiveNodeType

TEnumAsByte<EBTActiveNode::Type> FBehaviorTreeInstance::ActiveNodeType

active node type

◆ DeactivationNotify

FBTInstanceDeactivation FBehaviorTreeInstance::DeactivationNotify

delegate sending a notify when tree instance is removed from active stack

◆ InstanceIdIndex

uint8 FBehaviorTreeInstance::InstanceIdIndex

index of identifier (BehaviorTreeComponent.KnownInstances)

◆ InstanceMemory

TArray<uint8> FBehaviorTreeInstance::InstanceMemory

memory: instance

◆ ParallelTasks

TArray<FBehaviorTreeParallelTask> FBehaviorTreeInstance::ParallelTasks

active parallel tasks

◆ RootNode

TObjectPtr<UBTCompositeNode> FBehaviorTreeInstance::RootNode

root node in template


The documentation for this struct was generated from the following files: