UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FTimerManager Class Reference

#include <TimerManager.h>

+ Inheritance diagram for FTimerManager:

Public Member Functions

ENGINE_API void Tick (float DeltaTime)
 
ENGINE_API TStatId GetStatId () const
 
ENGINE_API FTimerManager (UGameInstance *GameInstance=nullptr)
 
virtual ENGINE_API ~FTimerManager ()
 
virtual ENGINE_API void OnCrash ()
 
template<class UserClass >
void SetTimer (FTimerHandle &InOutHandle, UserClass *InObj, typename FTimerDelegate::TMethodPtr< UserClass > InTimerMethod, float InRate, bool InbLoop=false, float InFirstDelay=-1.f)
 
template<class UserClass >
void SetTimer (FTimerHandle &InOutHandle, UserClass *InObj, typename FTimerDelegate::TConstMethodPtr< UserClass > InTimerMethod, float InRate, bool InbLoop=false, float InFirstDelay=-1.f)
 
void SetTimer (FTimerHandle &InOutHandle, FTimerDelegate const &InDelegate, float InRate, bool InbLoop, float InFirstDelay=-1.f)
 
void SetTimer (FTimerHandle &InOutHandle, FTimerDynamicDelegate const &InDynDelegate, float InRate, bool InbLoop, float InFirstDelay=-1.f)
 
void SetTimer (FTimerHandle &InOutHandle, float InRate, bool InbLoop, float InFirstDelay=-1.f)
 
void SetTimer (FTimerHandle &InOutHandle, TFunction< void(void)> &&Callback, float InRate, bool InbLoop, float InFirstDelay=-1.f)
 
template<class UserClass >
void SetTimer (FTimerHandle &InOutHandle, UserClass *InObj, typename FTimerDelegate::TMethodPtr< UserClass > InTimerMethod, float InRate, const FTimerManagerTimerParameters &InTimerParameters)
 
template<class UserClass >
void SetTimer (FTimerHandle &InOutHandle, UserClass *InObj, typename FTimerDelegate::TConstMethodPtr< UserClass > InTimerMethod, float InRate, const FTimerManagerTimerParameters &InTimerParameters)
 
void SetTimer (FTimerHandle &InOutHandle, FTimerDelegate const &InDelegate, float InRate, const FTimerManagerTimerParameters &InTimerParameters)
 
void SetTimer (FTimerHandle &InOutHandle, FTimerDynamicDelegate const &InDynDelegate, float InRate, const FTimerManagerTimerParameters &InTimerParameters)
 
void SetTimer (FTimerHandle &InOutHandle, float InRate, const FTimerManagerTimerParameters &InTimerParameters)
 
void SetTimer (FTimerHandle &InOutHandle, TFunction< void(void)> &&Callback, float InRate, const FTimerManagerTimerParameters &InTimerParameters)
 
template<class UserClass >
FTimerHandle SetTimerForNextTick (UserClass *inObj, typename FTimerDelegate::TMethodPtr< UserClass > inTimerMethod)
 
template<class UserClass >
FTimerHandle SetTimerForNextTick (UserClass *inObj, typename FTimerDelegate::TConstMethodPtr< UserClass > inTimerMethod)
 
FTimerHandle SetTimerForNextTick (FTimerDelegate const &InDelegate)
 
FTimerHandle SetTimerForNextTick (FTimerDynamicDelegate const &InDynDelegate)
 
FTimerHandle SetTimerForNextTick (TFunction< void(void)> &&Callback)
 
void ClearTimer (FTimerHandle &InHandle)
 
void ClearAllTimersForObject (void const *Object)
 
ENGINE_API void PauseTimer (FTimerHandle InHandle)
 
ENGINE_API void UnPauseTimer (FTimerHandle InHandle)
 
float GetTimerRate (FTimerHandle InHandle) const
 
bool IsTimerActive (FTimerHandle InHandle) const
 
bool IsTimerPaused (FTimerHandle InHandle) const
 
bool IsTimerPending (FTimerHandle InHandle) const
 
bool TimerExists (FTimerHandle InHandle) const
 
float GetTimerElapsed (FTimerHandle InHandle) const
 
float GetTimerRemaining (FTimerHandle InHandle) const
 
bool HasBeenTickedThisFrame () const
 
ENGINE_API FTimerHandle K2_FindDynamicTimerHandle (FTimerDynamicDelegate InDynamicDelegate) const
 
ENGINE_API void ListTimers () const
 
ENGINE_API FTimerHandle GenerateHandle (int32 Index)
 

Protected Member Functions

FTimerData const * FindTimer (FTimerHandle const &InHandle) const
 
ENGINE_API FTimerDataFindTimer (FTimerHandle const &InHandle)
 
- Protected Member Functions inherited from FNoncopyable
 FNoncopyable ()
 
 ~FNoncopyable ()
 

Detailed Description

Class to globally manage timers.

Constructor & Destructor Documentation

◆ FTimerManager()

FTimerManager::FTimerManager ( UGameInstance GameInstance = nullptr)
explicit

◆ ~FTimerManager()

FTimerManager::~FTimerManager ( )
virtual

Member Function Documentation

◆ ClearAllTimersForObject()

void FTimerManager::ClearAllTimersForObject ( void const *  Object)
inline

Clears all timers that are bound to functions on the given object.

◆ ClearTimer()

void FTimerManager::ClearTimer ( FTimerHandle InHandle)
inline

Clears a previously set timer, identical to calling SetTimer() with a <= 0.f rate. Invalidates the timer handle as it should no longer be used.

Parameters
InHandleThe handle of the timer to clear.

◆ FindTimer() [1/2]

FTimerData * FTimerManager::FindTimer ( FTimerHandle const &  InHandle)
protected

◆ FindTimer() [2/2]

FTimerData const * FTimerManager::FindTimer ( FTimerHandle const &  InHandle) const
inlineprotected

Will find a timer in the active, paused, or pending list.

◆ GenerateHandle()

FTimerHandle FTimerManager::GenerateHandle ( int32  Index)

Generates a handle for a timer at a given index

◆ GetStatId()

TStatId FTimerManager::GetStatId ( ) const

◆ GetTimerElapsed()

float FTimerManager::GetTimerElapsed ( FTimerHandle  InHandle) const
inline

Gets the current elapsed time for the specified timer.

Parameters
InHandleThe handle of the timer to check the elapsed time of.
Returns
The current time elapsed or -1.f if the timer does not exist.

◆ GetTimerRate()

float FTimerManager::GetTimerRate ( FTimerHandle  InHandle) const
inline

Gets the current rate (time between activations) for the specified timer.

Parameters
InHandleThe handle of the timer to return the rate of.
Returns
The current rate or -1.f if timer does not exist.

◆ GetTimerRemaining()

float FTimerManager::GetTimerRemaining ( FTimerHandle  InHandle) const
inline

Gets the time remaining before the specified timer is called

Parameters
InHandleThe handle of the timer to check the remaining time of.
Returns
The current time remaining, or -1.f if timer does not exist

◆ HasBeenTickedThisFrame()

bool FTimerManager::HasBeenTickedThisFrame ( ) const
inline

◆ IsTimerActive()

bool FTimerManager::IsTimerActive ( FTimerHandle  InHandle) const
inline

Returns true if the specified timer exists and is not paused

Parameters
InHandleThe handle of the timer to check for being active.
Returns
true if the timer exists and is active, false otherwise.

◆ IsTimerPaused()

bool FTimerManager::IsTimerPaused ( FTimerHandle  InHandle) const
inline

Returns true if the specified timer exists and is paused

Parameters
InHandleThe handle of the timer to check for being paused.
Returns
true if the timer exists and is paused, false otherwise.

◆ IsTimerPending()

bool FTimerManager::IsTimerPending ( FTimerHandle  InHandle) const
inline

Returns true if the specified timer exists and is pending

Parameters
InHandleThe handle of the timer to check for being pending.
Returns
true if the timer exists and is pending, false otherwise.

◆ K2_FindDynamicTimerHandle()

FTimerHandle FTimerManager::K2_FindDynamicTimerHandle ( FTimerDynamicDelegate  InDynamicDelegate) const

Finds a handle to a timer bound to a particular dynamic delegate. This function is intended to be used only by the K2 system.

Parameters
InDynamicDelegateThe dynamic delegate to search for.
Returns
A handle to the found timer - !IsValid() if no such timer was found.

Finds a handle to a dynamic timer bound to a particular pointer and function name.

◆ ListTimers()

void FTimerManager::ListTimers ( ) const

Debug command to output info on all timers currently set to the log.

◆ OnCrash()

void FTimerManager::OnCrash ( )
virtual

Called from crash handler to provide more debug information.

◆ PauseTimer()

void FTimerManager::PauseTimer ( FTimerHandle  InHandle)

Pauses a previously set timer.

Parameters
InHandleThe handle of the timer to pause.

◆ SetTimer() [1/12]

void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
float  InRate,
bool  InbLoop,
float  InFirstDelay = -1.f 
)
inline

◆ SetTimer() [2/12]

void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
float  InRate,
const FTimerManagerTimerParameters InTimerParameters 
)
inline

◆ SetTimer() [3/12]

void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
FTimerDelegate const &  InDelegate,
float  InRate,
bool  InbLoop,
float  InFirstDelay = -1.f 
)
inline

Version that takes any generic delegate.

◆ SetTimer() [4/12]

void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
FTimerDelegate const &  InDelegate,
float  InRate,
const FTimerManagerTimerParameters InTimerParameters 
)
inline

Version that takes any generic delegate.

◆ SetTimer() [5/12]

void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
FTimerDynamicDelegate const &  InDynDelegate,
float  InRate,
bool  InbLoop,
float  InFirstDelay = -1.f 
)
inline

Version that takes a dynamic delegate (e.g. for UFunctions).

◆ SetTimer() [6/12]

void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
FTimerDynamicDelegate const &  InDynDelegate,
float  InRate,
const FTimerManagerTimerParameters InTimerParameters 
)
inline

Version that takes a dynamic delegate (e.g. for UFunctions).

◆ SetTimer() [7/12]

void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
TFunction< void(void)> &&  Callback,
float  InRate,
bool  InbLoop,
float  InFirstDelay = -1.f 
)
inline

Version that takes a TFunction

◆ SetTimer() [8/12]

void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
TFunction< void(void)> &&  Callback,
float  InRate,
const FTimerManagerTimerParameters InTimerParameters 
)
inline

Version that takes a TFunction

◆ SetTimer() [9/12]

template<class UserClass >
void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
UserClass *  InObj,
typename FTimerDelegate::TConstMethodPtr< UserClass >  InTimerMethod,
float  InRate,
bool  InbLoop = false,
float  InFirstDelay = -1.f 
)
inline

◆ SetTimer() [10/12]

template<class UserClass >
void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
UserClass *  InObj,
typename FTimerDelegate::TConstMethodPtr< UserClass >  InTimerMethod,
float  InRate,
const FTimerManagerTimerParameters InTimerParameters 
)
inline

◆ SetTimer() [11/12]

template<class UserClass >
void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
UserClass *  InObj,
typename FTimerDelegate::TMethodPtr< UserClass >  InTimerMethod,
float  InRate,
bool  InbLoop = false,
float  InFirstDelay = -1.f 
)
inline

Sets a timer to call the given native function at a set interval. If a timer is already set for this handle, it will replace the current timer.

Parameters
InOutHandleIf the passed-in handle refers to an existing timer, it will be cleared before the new timer is added. A new handle to the new timer is returned in either case.
InObjObject to call the timer function on.
InTimerMethodMethod to call when timer fires.
InRateThe amount of time (in seconds) between set and firing. If <= 0.f, clears existing timers.
InbLooptrue to keep firing at Rate intervals, false to fire only once.
InFirstDelayThe time (in seconds) for the first iteration of a looping timer. If < 0.f InRate will be used.

◆ SetTimer() [12/12]

template<class UserClass >
void FTimerManager::SetTimer ( FTimerHandle InOutHandle,
UserClass *  InObj,
typename FTimerDelegate::TMethodPtr< UserClass >  InTimerMethod,
float  InRate,
const FTimerManagerTimerParameters InTimerParameters 
)
inline

Sets a timer to call the given native function at a set interval. If a timer is already set for this handle, it will replace the current timer.

Parameters
InOutHandleIf the passed-in handle refers to an existing timer, it will be cleared before the new timer is added. A new handle to the new timer is returned in either case.
InObjObject to call the timer function on.
InTimerMethodMethod to call when timer fires.
InRateThe amount of time (in seconds) between set and firing. If <= 0.f, clears existing timers.
InTimerParametersThe structure with additional timer looping and delay parameters.

◆ SetTimerForNextTick() [1/5]

FTimerHandle FTimerManager::SetTimerForNextTick ( FTimerDelegate const &  InDelegate)
inline

Version that takes any generic delegate.

◆ SetTimerForNextTick() [2/5]

FTimerHandle FTimerManager::SetTimerForNextTick ( FTimerDynamicDelegate const &  InDynDelegate)
inline

Version that takes a dynamic delegate (e.g. for UFunctions).

◆ SetTimerForNextTick() [3/5]

FTimerHandle FTimerManager::SetTimerForNextTick ( TFunction< void(void)> &&  Callback)
inline

Version that takes a TFunction

◆ SetTimerForNextTick() [4/5]

template<class UserClass >
FTimerHandle FTimerManager::SetTimerForNextTick ( UserClass *  inObj,
typename FTimerDelegate::TConstMethodPtr< UserClass >  inTimerMethod 
)
inline

◆ SetTimerForNextTick() [5/5]

template<class UserClass >
FTimerHandle FTimerManager::SetTimerForNextTick ( UserClass *  inObj,
typename FTimerDelegate::TMethodPtr< UserClass >  inTimerMethod 
)
inline

Sets a timer to call the given native function on the next tick.

Parameters
inObjObject to call the timer function on.
inTimerMethodMethod to call when timer fires.

◆ Tick()

void FTimerManager::Tick ( float  DeltaTime)

◆ TimerExists()

bool FTimerManager::TimerExists ( FTimerHandle  InHandle) const
inline

Returns true if the specified timer exists

Parameters
InHandleThe handle of the timer to check for existence.
Returns
true if the timer exists, false otherwise.

◆ UnPauseTimer()

void FTimerManager::UnPauseTimer ( FTimerHandle  InHandle)

Unpauses a previously set timer

Parameters
InHandleThe handle of the timer to unpause.

The documentation for this class was generated from the following files: