FTimerHandle
#include "Engine/TimerHandle.h" Description
An opaque handle that uniquely identifies a timer managed by FTimerManager. Pass it to SetTimer to register a timer, then use it to cancel, query, or pause that specific timer.
Caveats & Gotchas
- • A default-constructed FTimerHandle is invalid (IsValid() returns false). It becomes valid only after a successful SetTimer call.
- • Once a non-looping timer fires and is automatically cleared, the handle becomes invalid. Storing an old handle and querying it returns safe default values (-1.f, false) rather than crashing.
- • Handles are only meaningful to the FTimerManager that created them — do not share handles across different manager instances.
Example
Declare a timer handle as a class member C++
// MyActor.h
FTimerHandle RespawnTimer;
// MyActor.cpp — BeginPlay:
GetWorldTimerManager().SetTimer(
RespawnTimer, this, &AMyActor::Respawn, 3.0f
);
// Query:
if (RespawnTimer.IsValid())
{
float T = GetWorldTimerManager().GetTimerRemaining(RespawnTimer);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?