FTimerManager

Class to globally manage timers.

Windows
MacOS
Linux

Inheritance Hierarchy

FNoncopyable

FTimerManager

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/TimerManager.h

Include

#include "TimerManager.h"

Syntax

class FTimerManager : public FNoncopyable

Remarks

Class to globally manage timers.

Constructors

Name Description

Public function

FTimerManager

(
    UGameInstance* GameInstance
)

Timer API

Destructors

Name Description

Public function Virtual

~FTimerManager()

Functions

Name Description

Public function

void

 

ClearAllTimersForObject

(
    void const* Object
)

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

Public function

void

 

ClearTimer

(
    FTimerHandle& InHandle
)

Clears a previously set timer, identical to calling SetTimer() with a <= 0.f rate.

Protected function

FTimerData &...

 

FindTimer

(
    FTimerHandle const& InHandle
)

Protected function Const

FTimerData c...

 

FindTimer

(
    FTimerHandle const& InHandle
)

These should be private, but need to be protected so IMPLEMENT_GET_PROTECTED_FUNC works for testing.

Public function

FTimerHandle

 

GenerateHandle

(
    int32 Index
)

This should be private, but needs to be public for testing.

Public function Const

TStatId

 

GetStatId()

Public function Const

float

 

GetTimerElapsed

(
    FTimerHandle InHandle
)

Gets the current elapsed time for the specified timer.

Public function Const

float

 

GetTimerRate

(
    FTimerHandle InHandle
)

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

Public function Const

float

 

GetTimerRemaining

(
    FTimerHandle InHandle
)

Gets the time remaining before the specified timer is called

Public function Const

bool

 

HasBeenTickedThisFrame()

Public function Const

bool

 

IsTimerActive

(
    FTimerHandle InHandle
)

Returns true if the specified timer exists and is not paused

Public function

bool

 

IsTimerPaused

(
    FTimerHandle InHandle
)

Returns true if the specified timer exists and is paused

Public function

bool

 

IsTimerPending

(
    FTimerHandle InHandle
)

Returns true if the specified timer exists and is pending

Public function Const

FTimerHandle

 

K2_FindDynamicTimerHandle

(
    FTimerDynamicDelegate InDynamicDele...
)

Finds a handle to a timer bound to a particular dynamic delegate.

Public function Const

void

 

ListTimers()

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

Public function Virtual

void

 

OnCrash()

Called from crash handler to provide more debug information.

Public function

void

 

PauseTimer

(
    FTimerHandle InHandle
)

Pauses a previously set timer.

Public function

void

 

SetTimer

(
    FTimerHandle& InOutHandle,
    float InRate,
    bool InbLoop,
    float InFirstDelay
)

Public function

void

 

SetTimer

(
    FTimerHandle& InOutHandle,
    FTimerDelegate const& InDelegate,
    float InRate,
    bool InbLoop,
    float InFirstDelay
)

Version that takes any generic delegate.

Public function

void

 

SetTimer

(
    FTimerHandle& InOutHandle,
    FTimerDynamicDelegate const& InDyn...,
    float InRate,
    bool InbLoop,
    float InFirstDelay
)

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

Public function

void

 

SetTimer

(
    FTimerHandle& InOutHandle,
    TFunction< void(void)>&& Callback,
    float InRate,
    bool InbLoop,
    float InFirstDelay
)

Version that takes a TFunction

Public function

void

 

SetTimer

(
    FTimerHandle& InOutHandle,
    UserClass* InObj,
    typename FTimerDelegate::TUObjectMe...,
    float InRate,
    bool InbLoop,
    float InFirstDelay
)

Sets a timer to call the given native function at a set interval.

Public function

void

 

SetTimer

(
    FTimerHandle& InOutHandle,
    UserClass* InObj,
    typename FTimerDelegate::TUObjectMe...,
    float InRate,
    bool InbLoop,
    float InFirstDelay
)

Public function

FTimerHandle

 

SetTimerForNextTick

(
    UserClass* inObj,
    typename FTimerDelegate::TUObjectMe...
)

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

Public function

FTimerHandle

 

SetTimerForNextTick

(
    FTimerDelegate const& InDelegate
)

Version that takes any generic delegate.

Public function

FTimerHandle

 

SetTimerForNextTick

(
    FTimerDynamicDelegate const& InDyn...
)

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

Public function

FTimerHandle

 

SetTimerForNextTick

(
    TFunction< void(void)>&& Callback
)

Version that takes a TFunction

Public function

FTimerHandle

 

SetTimerForNextTick

(
    UserClass* inObj,
    typename FTimerDelegate::TUObjectMe...
)

Public function

void

 

Tick

(
    float DeltaTime
)

Public function

bool

 

TimerExists

(
    FTimerHandle InHandle
)

Returns true if the specified timer exists

Public function

void

 

UnPauseTimer

(
    FTimerHandle InHandle
)

Unpauses a previously set timer

Constants

Name

Description

LastAssignedSerialNumber

The last serial number we assigned from this timer manager

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback