FTimerManager
#include "TimerManager.h" Description
Manages all gameplay timers for a UWorld instance. Provides an API to schedule, cancel, pause, and inspect timed callbacks identified by FTimerHandle. Not UObject-derived; always access via UWorld::GetTimerManager().
Caveats & Gotchas
- • Never store a raw pointer to FTimerManager — always access it through GetWorld()->GetTimerManager() or the AActor/UActorComponent helper GetWorldTimerManager().
- • Timer callbacks bound to UObjects are automatically invalidated if the bound object is garbage collected — the timer will silently never fire.
- • FTimerManager is not thread-safe. All calls must be made from the game thread.
- • Timers pause automatically when the game is paused (TimeDilation == 0). Set bIgnorePause via FTimerManagerTimerParameters to keep a timer running during pause.
Example
Set and cancel a one-shot timer C++
// Header:
FTimerHandle MyTimer;
// BeginPlay:
GetWorldTimerManager().SetTimer(
MyTimer, this, &AMyActor::OnExpire, 5.0f
);
// Cancel before it fires:
GetWorldTimerManager().ClearTimer(MyTimer); Functions (5)
Lifecycle 1 ▼
| Access | Type | Name |
|---|---|---|
| public | function | FTimerManager::SetTimerForNextTick |
Utility 4 ▼
| Access | Type | Name |
|---|---|---|
| public | function | FTimerManager::ClearTimer |
| public | function | FTimerManager::GetTimerRemaining |
| public | function | FTimerManager::IsTimerActive |
| public | function | FTimerManager::SetTimer |
See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?