FTimerManager::TimerExists
#include "TimerManager.h"
Access: public
Specifiers: inline
Description
Returns true if a timer with the given handle exists in the active, paused, or pending list. Useful as a guard before reading timer state.
Caveats & Gotchas
- • A handle can become stale after ClearTimer is called — the same FTimerHandle struct then refers to nothing, and TimerExists will return false. Do not reuse invalidated handles.
- • This does not tell you whether the timer is active; a paused or pending timer also returns true. Use IsTimerActive, IsTimerPaused, or IsTimerPending for state-specific checks.
Signature
inline bool TimerExists(FTimerHandle InHandle) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InHandle | FTimerHandle | Handle to the timer to check for existence. | — |
Return Type
bool Example
Guard against setting duplicate timers C++
void AMyActor::TryStartRegen()
{
FTimerManager& TM = GetWorld()->GetTimerManager();
if (!TM.TimerExists(RegenHandle))
{
TM.SetTimer(RegenHandle, this, &AMyActor::OnRegen, 1.0f, true);
}
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?