Navigation
API > API/Runtime > API/Runtime/AIModule
Task are leaf nodes of behavior tree, which perform actual actions
Because some of them can be instanced for specific AI, following virtual functions are not marked as const:
- ExecuteTask
- AbortTask
- TickTask
- OnMessage
If your node is not being instanced (default behavior), DO NOT change any properties of object within those functions! Template nodes are shared across all behavior tree components using the same tree asset and must store their runtime properties in provided NodeMemory block (allocation size determined by GetInstanceMemorySize() )
| Name | UBTTaskNode |
| Type | class |
| Header File | /Engine/Source/Runtime/AIModule/Classes/BehaviorTree/BTTaskNode.h |
| Include Path | #include "BehaviorTree/BTTaskNode.h" |
Syntax
UCLASS (Abstract, MinimalAPI)
class UBTTaskNode : public UBTNode
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UBTNode → UBTTaskNode
Implements Interfaces
Derived Classes
UBTTaskNode derived class hierarchy
- UBTTask_BlackboardBase
- UBTTask_BlueprintBase
- UBTTask_FindAndUseGameplayBehaviorSmartObject
- UBTTask_FinishWithResult
- UBTTask_GameplayTaskBase
- UBTTask_MakeNoise
- UBTTask_PlayAnimation
- UBTTask_PlaySound
- UBTTask_RunBehavior
- UBTTask_RunBehaviorDynamic
- UBTTask_RunDynamicStateTree
- UBTTask_RunStateTree
- UBTTask_SetTagCooldown
- UBTTask_StopGameplayBehavior
- UBTTask_Wait
- UTestBTTask_BTStopAction
- UTestBTTask_LatentWithFlags
- UTestBTTask_Log
- UTestBTTask_SetFlag
- UTestBTTask_SetValue
- UTestBTTask_SetValuesWithLogs
- UTestBTTask_TimerBasedLatent
- UTestBTTask_ToggleFlag
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UBTTaskNode
(
const FObjectInitializer& ObjectInitializer |
BehaviorTree/BTTaskNode.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Services | TArray< TObjectPtr< UBTService > > | Service nodes | BehaviorTree/BTTaskNode.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual EBTNodeResult::Type ExecuteTask
(
UBehaviorTreeComponent& OwnerComp, |
Starts this task, should return Succeeded, Failed or InProgress (use FinishLatentTask() when returning InProgress) this function should be considered as const (don't modify state of object) if node is not instanced! | BehaviorTree/BTTaskNode.h | |
void FinishLatentAbort
(
UBehaviorTreeComponent& OwnerComp |
Helper function: finishes latent aborting | BehaviorTree/BTTaskNode.h | |
void FinishLatentTask
(
UBehaviorTreeComponent& OwnerComp, |
Helper function: finish latent executing | BehaviorTree/BTTaskNode.h | |
void ReceivedMessage
(
UBrainComponent* BrainComp, |
Message observer's hook | BehaviorTree/BTTaskNode.h | |
bool ShouldIgnoreRestartSelf() |
BehaviorTree/BTTaskNode.h | ||
EBTNodeResult::Type WrappedAbortTask
(
UBehaviorTreeComponent& OwnerComp, |
Wrapper for node instancing: AbortTask | BehaviorTree/BTTaskNode.h | |
EBTNodeResult::Type WrappedExecuteTask
(
UBehaviorTreeComponent& OwnerComp, |
Wrapper for node instancing: ExecuteTask | BehaviorTree/BTTaskNode.h | |
void WrappedOnTaskFinished
(
UBehaviorTreeComponent& OwnerComp, |
Wrapper for node instancing: OnTaskFinished | BehaviorTree/BTTaskNode.h | |
bool WrappedTickTask
(
UBehaviorTreeComponent& OwnerComp, |
Wrapper for node instancing: TickTask | BehaviorTree/BTTaskNode.h |
Overridden from UBTNode
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FName GetNodeIconName() |
Get the name of the icon used to display this node in the editor | BehaviorTree/BTTaskNode.h | |
virtual uint16 GetSpecialMemorySize() |
Size of special, hidden memory block for internal mechanics | BehaviorTree/BTTaskNode.h |
Overridden from IGameplayTaskOwnerInterface
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnGameplayTaskDeactivated
(
UGameplayTask& Task |
BehaviorTree/BTTaskNode.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual EBTNodeResult::Type AbortTask
(
UBehaviorTreeComponent& OwnerComp, |
Aborts this task, should return Aborted or InProgress (use FinishLatentAbort() when returning InProgress) this function should be considered as const (don't modify state of object) if node is not instanced! | BehaviorTree/BTTaskNode.h | |
void InitNotifyFlags
(
TickTask, |
BehaviorTree/BTTaskNode.h | ||
virtual void OnMessage
(
UBehaviorTreeComponent& OwnerComp, |
Message handler, default implementation will finish latent execution/abortion this function should be considered as const (don't modify state of object) if node is not instanced! | BehaviorTree/BTTaskNode.h | |
virtual void OnTaskFinished
(
UBehaviorTreeComponent& OwnerComp, |
Called when task execution is finished this function should be considered as const (don't modify state of object) if node is not instanced! bNotifyTaskFinished must be set to true for this function to be called Calling INIT_TASK_NODE_NOTIFY_FLAGS in the constructor of the task will set this flag automatically | BehaviorTree/BTTaskNode.h | |
void SetNextTickTime
(
uint8* NodeMemory, |
Sets next tick time | BehaviorTree/BTTaskNode.h | |
void StopWaitingForMessages
(
UBehaviorTreeComponent& OwnerComp |
Unregister message observers | BehaviorTree/BTTaskNode.h | |
virtual void TickTask
(
UBehaviorTreeComponent& OwnerComp, |
Ticks this task this function should be considered as const (don't modify state of object) if node is not instanced! bNotifyTick must be set to true for this function to be called Calling INIT_TASK_NODE_NOTIFY_FLAGS in the constructor of the task will set this flag automatically | BehaviorTree/BTTaskNode.h | |
void WaitForMessage
(
UBehaviorTreeComponent& OwnerComp, |
Register message observer | BehaviorTree/BTTaskNode.h | |
void WaitForMessage
(
UBehaviorTreeComponent& OwnerComp, |
BehaviorTree/BTTaskNode.h |