Navigation
API > API/Runtime > API/Runtime/AIModule
| Name | UBehaviorTreeComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/AIModule/Classes/BehaviorTree/BehaviorTreeComponent.h |
| Include Path | #include "BehaviorTree/BehaviorTreeComponent.h" |
Syntax
UCLASS (ClassGroup=AI, Meta=(BlueprintSpawnableComponent), MinimalAPI)
class UBehaviorTreeComponent : public UBrainComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → UBrainComponent → UBehaviorTreeComponent
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UBehaviorTreeComponent
(
const FObjectInitializer& ObjectInitializer |
BehaviorTree/BehaviorTreeComponent.h | ||
UBehaviorTreeComponent
(
FVTableHelper& Helper |
DO NOT USE. This constructor is for internal usage only for hot-reload purposes. | BehaviorTree/BehaviorTreeComponent.h |
Structs
| Name | Remarks |
|---|---|
| FBranchActionInfo | |
| FBTSuspendBranchActionsScoped |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FBTSuspendBranchDeactivationScoped | FBTSuspendBranchActionsScoped | BehaviorTree/BehaviorTreeComponent.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| ActiveDebuggerCounter | int32 | Set when at least one debugger window is opened | BehaviorTree/BehaviorTreeComponent.h |
| bAddedEndFrameCallback | bool | Code for timing BT Search for FramePro. | BehaviorTree/BehaviorTreeComponent.h |
| FrameSearchTime | double | BehaviorTree/BehaviorTreeComponent.h | |
| NumSearchTimeCalls | int32 | BehaviorTree/BehaviorTreeComponent.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddCooldownTagDuration
(
FGameplayTag CooldownTag, |
Add to the cooldown tag's duration | BehaviorTree/BehaviorTreeComponent.h |
|
virtual FString DescribeActiveTasks() |
BehaviorTree/BehaviorTreeComponent.h | ||
virtual FString DescribeActiveTrees() |
BehaviorTree/BehaviorTreeComponent.h | ||
int32 FindInstanceContainingNode
(
const UBTNode* Node |
Tries to find behavior tree instance in context | BehaviorTree/BehaviorTreeComponent.h | |
| Tries to find template node for given instanced node | BehaviorTree/BehaviorTreeComponent.h | ||
void ForEachChildTask
(
TFunctionRef< void(UBTTaskNode&, const FBehaviorTreeInstance&, int32 InstanceIndex)> Functor |
Will call the given functor on each task node in the current instance stacks. | BehaviorTree/BehaviorTreeComponent.h | |
void ForEachChildTask
(
UBTCompositeNode& StartNode, |
Will call the given functor on each child node from the given start node. | BehaviorTree/BehaviorTreeComponent.h | |
float GetAccumulatedTickDeltaTime() |
Returns the accumulated delta time for the current tick | BehaviorTree/BehaviorTreeComponent.h | |
uint16 GetActiveInstanceIdx() |
Get index of active instance on stack | BehaviorTree/BehaviorTreeComponent.h | |
const UBTNode * GetActiveNode() |
BehaviorTree/BehaviorTreeComponent.h | ||
UBehaviorTree * GetCurrentTree() |
BehaviorTree/BehaviorTreeComponent.h | ||
uint8 * GetNodeMemory
(
const UBTNode* Node, |
BehaviorTree/BehaviorTreeComponent.h | ||
UBehaviorTree * GetRootTree() |
BehaviorTree/BehaviorTreeComponent.h | ||
double GetTagCooldownEndTime
(
FGameplayTag CooldownTag |
BehaviorTree/BehaviorTreeComponent.h |
|
|
EBTTaskStatus::Type GetTaskStatus
(
const UBTTaskNode* TaskNode |
BehaviorTree/BehaviorTreeComponent.h | ||
bool IsAbortPending() |
BehaviorTree/BehaviorTreeComponent.h | ||
bool IsAuxNodeActive
(
const UBTAuxiliaryNode* AuxNode |
BehaviorTree/BehaviorTreeComponent.h | ||
bool IsAuxNodeActive
(
const UBTAuxiliaryNode* AuxNodeTemplate, |
BehaviorTree/BehaviorTreeComponent.h | ||
bool IsExecutingBranch
(
const UBTNode* Node, |
BehaviorTree/BehaviorTreeComponent.h | ||
bool IsInstanceStackEmpty() |
Returns true if InstanceStack contains any BT runtime instances | BehaviorTree/BehaviorTreeComponent.h | |
bool IsRestartPending() |
BehaviorTree/BehaviorTreeComponent.h | ||
void OnTaskFinished
(
const UBTTaskNode* TaskNode, |
Finish latent execution or abort | BehaviorTree/BehaviorTreeComponent.h | |
void ProcessExecutionRequest() |
Process execution flow | BehaviorTree/BehaviorTreeComponent.h | |
void RegisterMessageObserver
(
const UBTTaskNode* TaskNode, |
BehaviorTree/BehaviorTreeComponent.h | ||
void RegisterMessageObserver
(
const UBTTaskNode* TaskNode, |
Setup message observer for given task | BehaviorTree/BehaviorTreeComponent.h | |
void RegisterParallelTask
(
const UBTTaskNode* TaskNode |
Add active parallel task | BehaviorTree/BehaviorTreeComponent.h | |
void RequestBranchActivation
(
const UBTDecorator& RequestedBy, |
Request branch activation: helper for decorator | BehaviorTree/BehaviorTreeComponent.h | |
void RequestBranchDeactivation
(
const UBTDecorator& RequestedBy |
Request branch deactivation: helper for decorator | BehaviorTree/BehaviorTreeComponent.h | |
void RequestBranchEvaluation
(
const UBTDecorator& RequestedBy |
Request branch evaluation: helper for decorator | BehaviorTree/BehaviorTreeComponent.h | |
void RequestBranchEvaluation
(
EBTNodeResult::Type ContinueWithResult |
Request branch evaluation: helper for active node (ex: tasks) | BehaviorTree/BehaviorTreeComponent.h | |
void RequestExecution
(
const UBTCompositeNode* RequestedOn, |
Request execution change | BehaviorTree/BehaviorTreeComponent.h | |
void RequestExecution
(
EBTNodeResult::Type ContinueWithResult |
Replaced by RequestBranchEvaluation with EBTNodeResult | BehaviorTree/BehaviorTreeComponent.h | |
void RequestExecution
(
const UBTDecorator* RequestedBy |
Replaced by the RequestBranchEvaluation from decorator | BehaviorTree/BehaviorTreeComponent.h | |
void RequestUnregisterAuxNodesInBranch
(
const UBTCompositeNode* Node |
Request unregistration of aux nodes in the specified branch | BehaviorTree/BehaviorTreeComponent.h | |
void RestartTree
(
EBTRestartMode RestartMode |
Restarts execution from root | BehaviorTree/BehaviorTreeComponent.h | |
void ScheduleExecutionUpdate() |
Schedule execution flow update in next tick | BehaviorTree/BehaviorTreeComponent.h | |
void ScheduleNextTick
(
float NextDeltaTime |
END UActorComponent overrides Schedule when will be the next tick, 0.0f means next frame, FLT_MAX means never | BehaviorTree/BehaviorTreeComponent.h | |
virtual void SetDynamicSubtree
(
FGameplayTag InjectTag, |
Assign subtree to RunBehaviorDynamic task specified by tag. | BehaviorTree/BehaviorTreeComponent.h | |
virtual void SetDynamicSubtree
(
FGameplayTag InjectTag, |
Assign subtree to RunBehaviorDynamic task specified by tag. | BehaviorTree/BehaviorTreeComponent.h |
|
void StartTree
(
UBehaviorTree& Asset, |
Starts execution from root | BehaviorTree/BehaviorTreeComponent.h | |
void StopTree
(
EBTStopMode::Type StopMode |
Stops execution | BehaviorTree/BehaviorTreeComponent.h | |
bool TreeHasBeenStarted() |
Indicates instance has been initialized to work with specific BT asset | BehaviorTree/BehaviorTreeComponent.h | |
void UnregisterAuxNodesInBranch
(
const UBTCompositeNode* Node, |
Unregister all aux nodes in branch of tree | BehaviorTree/BehaviorTreeComponent.h | |
void UnregisterAuxNodesInRange
(
const FBTNodeIndex& FromIndex, |
Unregister all aux nodes between given execution index range: FromIndex < AuxIndex < ToIndex | BehaviorTree/BehaviorTreeComponent.h | |
void UnregisterAuxNodesUpTo
(
const FBTNodeIndex& Index |
Unregister all aux nodes less important than given index | BehaviorTree/BehaviorTreeComponent.h | |
void UnregisterMessageObserversFrom
(
const FBTNodeIndex& TaskIdx |
BehaviorTree/BehaviorTreeComponent.h | ||
void UnregisterMessageObserversFrom
(
const UBTTaskNode* TaskNode |
Remove message observers registered with task | BehaviorTree/BehaviorTreeComponent.h | |
void UnregisterParallelTask
(
const UBTTaskNode* TaskNode, |
Remove parallel task | BehaviorTree/BehaviorTreeComponent.h |
Overridden from UBrainComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Cleanup() |
AI logic won't be needed anymore, stop all activity and run cleanup | BehaviorTree/BehaviorTreeComponent.h | |
virtual void DescribeSelfToVisLog
(
FVisualLogEntry* Snapshot |
BehaviorTree/BehaviorTreeComponent.h | ||
virtual FString GetDebugInfoString() |
BehaviorTree/BehaviorTreeComponent.h | ||
virtual void HandleMessage
(
const FAIMessage& Message |
BehaviorTree/BehaviorTreeComponent.h | ||
virtual bool IsPaused() |
BehaviorTree/BehaviorTreeComponent.h | ||
virtual bool IsRunning() |
BehaviorTree/BehaviorTreeComponent.h | ||
virtual void PauseLogic
(
const FString& Reason |
Pause logic and blackboard updates. | BehaviorTree/BehaviorTreeComponent.h | |
virtual void RestartLogic() |
Restarts currently running or previously ran brain logic. | BehaviorTree/BehaviorTreeComponent.h | |
virtual EAILogicResuming::Type ResumeLogic
(
const FString& Reason |
Resumes paused brain logic. MUST be called by child implementations! | BehaviorTree/BehaviorTreeComponent.h | |
virtual void StartLogic() |
Starts brain logic. If brain is already running, will not do anything. | BehaviorTree/BehaviorTreeComponent.h | |
virtual void StopLogic
(
const FString& Reason |
Stops currently running brain logic. | BehaviorTree/BehaviorTreeComponent.h |
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void RegisterComponentTickFunctions
(
bool bRegister |
BehaviorTree/BehaviorTreeComponent.h | ||
virtual void SetComponentTickEnabled
(
bool bEnabled |
BehaviorTree/BehaviorTreeComponent.h | ||
virtual void TickComponent
(
float DeltaTime, |
BEGIN UActorComponent overrides | BehaviorTree/BehaviorTreeComponent.h | |
virtual void UninitializeComponent() |
BehaviorTree/BehaviorTreeComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AbortCurrentTask() |
Abort currently executed task | BehaviorTree/BehaviorTreeComponent.h | |
void ActivateBranch
(
const UBTDecorator& RequestedBy, |
Activate a branch as the decorator conditions are now passing | BehaviorTree/BehaviorTreeComponent.h | |
void ApplyAllSearchUpdates
(
const TArray< FBehaviorTreeSearchUpdate >& UpdateList, |
Apply updates and post update from specified UpdateList. | BehaviorTree/BehaviorTreeComponent.h | |
void ApplyDiscardedSearch() |
Apply pending node updates required for discarded search | BehaviorTree/BehaviorTreeComponent.h | |
void ApplySearchData
(
UBTNode* NewActiveNode |
Apply pending node updates from SearchData | BehaviorTree/BehaviorTreeComponent.h | |
void ApplySearchUpdates
(
const TArray< FBehaviorTreeSearchUpdate >& UpdateList, |
Apply updates from specific list | BehaviorTree/BehaviorTreeComponent.h | |
EBTNodeRelativePriority CalculateRelativePriority
(
const UBTNode* NodeA, |
Return NodeA's relative priority in regards to NodeB | BehaviorTree/BehaviorTreeComponent.h | |
void CopyInstanceMemoryFromPersistent() |
Copy memory block from persistent memory to running instances (rollback) | BehaviorTree/BehaviorTreeComponent.h | |
void CopyInstanceMemoryToPersistent() |
Copy memory block from running instances to persistent memory | BehaviorTree/BehaviorTreeComponent.h | |
void DeactivateBranch
(
const UBTDecorator& RequestedBy |
Deactivate a branch as the decorator conditions are not passing anymore | BehaviorTree/BehaviorTreeComponent.h | |
bool DeactivateUpTo
(
const UBTCompositeNode* Node, |
Deactivate all nodes up to requested one | BehaviorTree/BehaviorTreeComponent.h | |
void EvaluateBranch
(
const UBTDecorator& RequestedBy |
Evaluate a branch as the decorator conditions have changed | BehaviorTree/BehaviorTreeComponent.h | |
void EvaluateBranch
(
EBTNodeResult::Type LastResult |
Evaluate a branch as current active node is finished | BehaviorTree/BehaviorTreeComponent.h | |
void ExecuteTask
(
UBTTaskNode* TaskNode |
Execute new task | BehaviorTree/BehaviorTreeComponent.h | |
bool HasActiveLatentAborts() |
Return true if the current or any parallel task has a latent abort in progress | BehaviorTree/BehaviorTreeComponent.h | |
virtual void OnTreeFinished() |
Called when tree runs out of nodes to execute | BehaviorTree/BehaviorTreeComponent.h | |
void ProcessPendingExecution() |
Apply pending execution from last task search | BehaviorTree/BehaviorTreeComponent.h | |
void ProcessPendingInitialize() |
Apply pending tree initialization | BehaviorTree/BehaviorTreeComponent.h | |
bool PushInstance
(
UBehaviorTree& TreeAsset |
Push behavior tree instance on execution stack @NOTE: should never be called out-side of BT execution, meaning only BT tasks can push another BT instance! | BehaviorTree/BehaviorTreeComponent.h | |
void RemoveAllInstances() |
Remove instanced nodes, known subtree instances and safely clears their persistent memory | BehaviorTree/BehaviorTreeComponent.h | |
void ResumeBranchActions() |
Resume branch actions and execute all the queued up ones | BehaviorTree/BehaviorTreeComponent.h | |
void ResumeBranchDeactivation() |
BehaviorTree/BehaviorTreeComponent.h | ||
void RollbackSearchChanges() |
Restore state of tree to state before search | BehaviorTree/BehaviorTreeComponent.h | |
| Describe blackboard's key values | BehaviorTree/BehaviorTreeComponent.h | ||
void StoreDebuggerExecutionStep
(
EBTExecutionSnap::Type SnapType |
Make a snapshot for debugger | BehaviorTree/BehaviorTreeComponent.h | |
void StoreDebuggerInstance
(
FBehaviorTreeDebuggerInstance& InstanceInfo, |
Make a snapshot for debugger from given subtree instance | BehaviorTree/BehaviorTreeComponent.h | |
void StoreDebuggerRemovedInstance
(
uint16 InstanceIdx |
BehaviorTree/BehaviorTreeComponent.h | ||
void StoreDebuggerRestart
(
const UBTNode* Node, |
Store restarting node for debugger | BehaviorTree/BehaviorTreeComponent.h | |
| Gather nodes runtime descriptions | BehaviorTree/BehaviorTreeComponent.h | ||
void StoreDebuggerSearchStep
(
const UBTNode* Node, |
Store search step for debugger | BehaviorTree/BehaviorTreeComponent.h | |
void StoreDebuggerSearchStep
(
const UBTNode* Node, |
BehaviorTree/BehaviorTreeComponent.h | ||
void SuspendBranchActions
(
EBTBranchAction BranchActions |
Suspend any branch actions and queue them to be processed later by ResumeBranchActions() | BehaviorTree/BehaviorTreeComponent.h | |
void SuspendBranchDeactivation() |
BehaviorTree/BehaviorTreeComponent.h | ||
void TickNewlyAddedAuxNodesHelper() |
BehaviorTree/BehaviorTreeComponent.h | ||
void TrackNewLatentAborts() |
Tracks if there are new tasks using latent abort in progress | BehaviorTree/BehaviorTreeComponent.h | |
bool TrackPendingLatentAborts() |
Returns true if execution was waiting on latent aborts and they are all finished; | BehaviorTree/BehaviorTreeComponent.h | |
void UpdateDebuggerAfterExecution
(
const UBTTaskNode* TaskNode, |
Update runtime description of given task node in latest debugger's snapshot | BehaviorTree/BehaviorTreeComponent.h | |
uint8 UpdateInstanceId
(
UBehaviorTree* TreeAsset, |
Add unique Id of newly created subtree to KnownInstances list and return its index | BehaviorTree/BehaviorTreeComponent.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static void EndFrame() |
Code for timing BT Search for FramePro. | BehaviorTree/BehaviorTreeComponent.h | |
static bool IsDebuggerActive() |
Check if debugger is currently running and can gather data | BehaviorTree/BehaviorTreeComponent.h |