Navigation
API > API/Runtime > API/Runtime/AIModule
Behavior Tree service nodes is designed to perform "background" tasks that update AI's knowledge.
Services are being executed when underlying branch of behavior tree becomes active, but unlike tasks they don't return any results and can't directly affect execution flow.
Usually they perform periodical checks (see TickNode) and often store results in blackboard. If any decorator node below requires results of check beforehand, use OnSearchStart function. Keep in mind that any checks performed there have to be instantaneous!
Other typical use case is creating a marker when specific branch is being executed (see OnBecomeRelevant, OnCeaseRelevant), by setting a flag in blackboard.
Because some of them can be instanced for specific AI, following virtual functions are not marked as const:
- OnBecomeRelevant (from UBTAuxiliaryNode)
- OnCeaseRelevant (from UBTAuxiliaryNode)
- TickNode (from UBTAuxiliaryNode)
- OnSearchStart
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 | UBTService |
| Type | class |
| Header File | /Engine/Source/Runtime/AIModule/Classes/BehaviorTree/BTService.h |
| Include Path | #include "BehaviorTree/BTService.h" |
Syntax
UCLASS (Abstract, MinimalAPI)
class UBTService : public UBTAuxiliaryNode
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UBTNode → UBTAuxiliaryNode → UBTService
Implements Interfaces
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UBTService
(
const FObjectInitializer& ObjectInitializer |
BehaviorTree/BTService.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void NotifyParentActivation
(
FBehaviorTreeSearchData& SearchData |
BehaviorTree/BTService.h |
Overridden from UBTNode
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FString GetStaticDescription() |
BehaviorTree/BTService.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FString GetStaticServiceDescription() |
Gets the description for our service. | BehaviorTree/BTService.h | |
FString GetStaticTickIntervalDescription() |
Gets the description of our tick interval. | BehaviorTree/BTService.h | |
void InitNotifyFlags
(
TickNode, |
BehaviorTree/BTService.h | ||
virtual void OnSearchStart
(
FBehaviorTreeSearchData& SearchData |
Called when search enters underlying branch this function should be considered as const (don't modify state of object) if node is not instanced! bNotifyOnSearch must be set to true for this function to be called | BehaviorTree/BTService.h | |
virtual void ScheduleNextTick
(
UBehaviorTreeComponent& OwnerComp, |
Set next tick time | BehaviorTree/BTService.h |
Overridden from UBTAuxiliaryNode
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void TickNode
(
UBehaviorTreeComponent& OwnerComp, |
Update next tick interval 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_SERVICE_NODE_NOTIFY_FLAGS in the constructor of the service will set this flag automatically | BehaviorTree/BTService.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/BTService.h |