UWorld::GetTimeSeconds
#include "Engine/World.h"
Access: public
Specifiers: const
Description
Returns the elapsed game time in seconds since the world began play. This value advances with DeltaTime each frame and respects time dilation. Use this for time-based gameplay logic.
Signature
double GetTimeSeconds() const Return Type
double Caveats & Gotchas
- • GetTimeSeconds() is affected by time dilation (slow-motion effects). For real-world elapsed time, use `GetRealTimeSeconds()` instead.
- • Returns 0 before BeginPlay is called.
Example
Timestamping an event C++
double EventTime = GetWorld()->GetTimeSeconds();
UE_LOG(LogTemp, Log, TEXT("Event occurred at game time: %.2f"), EventTime);
// Later, compute elapsed:
double Elapsed = GetWorld()->GetTimeSeconds() - EventTime; See Also
Version History
Introduced in: 1.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?