RealDocs

FTimerManager::ClearTimer

function Engine Since 4.0
#include "TimerManager.h"
Access: public Specifiers: inline

Description

Stops and removes the timer identified by InHandle and invalidates the handle so it can no longer be used to query or cancel that timer.

Signature

void ClearTimer( FTimerHandle& InHandle )

Parameters

Name Type Description Default
InHandle FTimerHandle& Handle of the timer to cancel. Invalidated after this call.

Return Type

void

Caveats & Gotchas

  • Calling ClearTimer on an already-cleared or invalid handle is safe — it is a no-op.
  • The timer callback does not fire when the timer is cleared, even if it was about to fire on the current tick.
  • To clear all timers bound to a specific object at once, use ClearAllTimersForObject(Object).

Example

Cancel a timer if it is still running C++
if (GetWorldTimerManager().IsTimerActive(RegenHandle))
{
	GetWorldTimerManager().ClearTimer(RegenHandle);
}
// RegenHandle is now invalid

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.