RealDocs

AActor::GetGameTimeSinceCreation

function Engine Blueprint Since 4.14
#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
Event Tick Delta Seconds Delta Seconds Branch Condition Condition True False Destroy Actor Target is Actor Get Game Time Since Creation Target is Actor Return Value > A B 30.0 Return Value Return Value
Edit Blueprint graph Destroy the actor after 30 seconds of game time
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
Expire a pickup after 30 seconds of game time C++
void APickup::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    if (GetGameTimeSinceCreation() > 30.0f)
    {
        Destroy();
    }
}

Version History

Introduced in: 4.14

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.