Description
Returns true if the timer referred to by InHandle is currently running and not paused. Use this to guard against double-starting a timer or to conditionally restart one.
Signature
bool IsTimerActive( FTimerHandle InHandle ) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InHandle | FTimerHandle | Handle of the timer to check. | — |
Return Type
bool Caveats & Gotchas
- • A timer currently executing its callback (ETimerStatus::Executing) is considered active — IsTimerActive returns true during the callback itself.
- • Returns false for both non-existent and paused timers. Use IsTimerPaused() to distinguish a paused timer from a cleared one.
- • A default-constructed (invalid) handle always returns false.
Example
Guard against double-starting a timer C++
void AMyActor::StartCooldown()
{
FTimerManager& TM = GetWorld()->GetTimerManager();
if (!TM.IsTimerActive(CooldownHandle))
{
TM.SetTimer(CooldownHandle, this, &AMyActor::OnCooldownEnd, 5.f, false);
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?