UBTService_Timer
Overview
UBTService_Timer is a Behavior Tree service used to manage a countdown timer. It inherits from UBTService and provides functionality to initialize, tick, and handle the lifecycle of the timer. The timer can be set to loop or not, and it updates a blackboard key when the timer expires.
Properties
Type | Name | Access | Description |
|---|---|---|---|
| Duration | EditAnywhere | The duration of the timer. |
| bLoop | EditAnywhere | Whether the timer should loop after expiration. |
| DoneKey | EditAnywhere | The blackboard key to update when the timer expires. |
Functions
Return Type | Signature | Description |
|---|---|---|
| GetInstanceMemorySize() const | Returns the size of the instance memory required for this service. |
| InitializeFromAsset(UBehaviorTree& Asset) | Initializes the service from a behavior tree asset. |
| OnBecomeRelevant(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) | Called when the service becomes relevant. Sets up the timer and clears the blackboard key. |
| TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) | Ticks the node, updating the timer and blackboard key as necessary. |
| OnCeaseRelevant(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) | Called when the service ceases to be relevant. Resets the timer and clears the blackboard key. |
Usage & Implementation Notes
Threading Constraints: This service is designed to run on the game thread.
Replication Requirements: None.
Memory Lifetime Management: The memory for
FTimerMemis managed by the Behavior Tree system.Initialization Dependencies: Depends on a valid blackboard asset.