RealDocs

UKismetSystemLibrary::GetGameTimeInSeconds

function Engine Blueprint Since 4.0
#include "Kismet/KismetSystemLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Returns the current game time in seconds. This pauses when the game is paused and is scaled by slomo, unlike real time.

Caveats & Gotchas

  • Because it's affected by dilation/slomo and pausing, it's not suitable for measuring real wall-clock elapsed time — use UGameplayStatics::GetRealTimeSeconds for that.
  • Requires a valid WorldContextObject; passing an object with no world (e.g. a CDO) will fail to resolve and can return 0.

Signature

static double GetGameTimeInSeconds(const UObject* WorldContextObject)

Parameters

Name Type Description Default
WorldContextObject const UObject* Object used to resolve the current world.

Return Type

double

Example

Time a gameplay cooldown C++
double Now = UKismetSystemLibrary::GetGameTimeInSeconds(this);
if (Now - LastFireTime > FireCooldown)
{
    Fire();
    LastFireTime = Now;
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.