AActor::GetGameTimeSinceCreation
#include "GameFramework/Actor.h"
Access: public
Specifiers: UFUNCTIONBlueprintPureconst
Description
Returns the number of game-time seconds elapsed since this actor was created, equivalent to UGameplayStatics::GetGameTimeSinceCreation minus the actor's creation time.
Caveats & Gotchas
- • This is game time, not real wall-clock time. It respects time dilation (including global slow motion and per-actor custom time dilation). If the game is paused, this timer also pauses.
- • The creation timestamp is recorded when the actor is constructed, not when BeginPlay fires. Actors pre-placed in a level will have a longer elapsed time than dynamically spawned ones if BeginPlay is delayed by streaming.
Signature
ENGINE_API float GetGameTimeSinceCreation() const; Return Type
float Examples
Destroy the actor after 30 seconds of game time
Blueprint
Expire a pickup after 30 seconds of game time C++
void APickup::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (GetGameTimeSinceCreation() > 30.0f)
{
Destroy();
}
} Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?