FTimerManager::PauseTimer
#include "TimerManager.h"
Access: public
Specifiers: ENGINE_API
Description
Temporarily suspends a timer so it stops counting down. The remaining time is preserved and resumes from that point when UnPauseTimer is called.
Caveats & Gotchas
- • Pausing a timer that is already paused has no effect, but does not produce a warning. Calling PauseTimer on an invalid or expired handle is a silent no-op.
- • When a timer is paused, its ExpireTime is re-based to be relative to zero (i.e. it stores the remaining time, not the absolute expiry). Direct inspection of FTimerData::ExpireTime will give different semantics depending on pause state.
Signature
ENGINE_API void PauseTimer(FTimerHandle InHandle) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InHandle | FTimerHandle | Handle to the timer to pause. | — |
Return Type
void Example
Pause and resume a countdown C++
// Pause the timer when the game is suspended
void AMyActor::OnGamePaused()
{
FTimerManager& TM = GetWorld()->GetTimerManager();
TM.PauseTimer(CountdownHandle);
}
void AMyActor::OnGameResumed()
{
FTimerManager& TM = GetWorld()->GetTimerManager();
TM.UnPauseTimer(CountdownHandle);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?