FTimerManager::ClearAllTimersForObject
#include "TimerManager.h"
Access: public
Specifiers: inline
Description
Cancels every timer whose delegate is bound to the specified object. The typical call site is a UObject destructor or EndPlay, where leaving dangling callbacks would be unsafe.
Caveats & Gotchas
- • Silently does nothing if Object is null, but you still incur a function-call and branch overhead — prefer checking for null before calling in tight loops.
- • Only clears timers whose delegate was originally created with a UObject binding (e.g. CreateUObject). Timers bound via raw TFunction lambdas have no associated object key and are NOT cleared by this call.
Signature
inline void ClearAllTimersForObject(void const* Object) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Object | void const* | Raw pointer to the object whose bound timers should all be cancelled. | — |
Return Type
void Example
Clean up all timers on EndPlay C++
void AMyActor::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
Super::EndPlay(EndPlayReason);
GetWorld()->GetTimerManager().ClearAllTimersForObject(this);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?