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

#include <Ticker.h>

+ Inheritance diagram for FTSTicker:

Public Types

using FDelegateHandle = TWeakPtr< FElement >
 

Public Member Functions

CORE_API FDelegateHandle AddTicker (const FTickerDelegate &InDelegate, float InDelay=0.0f)
 
CORE_API FDelegateHandle AddTicker (const TCHAR *InName, float InDelay, TUniqueFunction< bool(float)> &&InFunction)
 
CORE_API void Tick (float DeltaTime)
 
CORE_API void Reset ()
 

Static Public Member Functions

static CORE_API FTSTickerGetCoreTicker ()
 
static CORE_API void RemoveTicker (FDelegateHandle Handle)
 

Detailed Description

Thread-safe ticker class. Fires delegates after a delay.

Member Typedef Documentation

◆ FDelegateHandle

Member Function Documentation

◆ AddTicker() [1/2]

FTSTicker::FDelegateHandle FTSTicker::AddTicker ( const FTickerDelegate InDelegate,
float  InDelay = 0.0f 
)

Add a new ticker with a given delay / interval

Can be called concurrently. Resources used by the delegate must be released on the ticking thread.

Parameters
InDelegateDelegate to fire after the delay
InDelayDelay until next fire; 0 means "next frame"

◆ AddTicker() [2/2]

FTSTicker::FDelegateHandle FTSTicker::AddTicker ( const TCHAR InName,
float  InDelay,
TUniqueFunction< bool(float)> &&  InFunction 
)

Add a new ticker with a given delay / interval.

Can be called concurrently.

Parameters
InNameName of this ticker for profiling
InDelayDelay until next fire; 0 means "next frame"
FunctionFunction to execute. Should return true to fire after another InDelay time

◆ GetCoreTicker()

FTSTicker & FTSTicker::GetCoreTicker ( )
static

Singleton used for the ticker in Core / Launch. If you add a new ticker for a different subsystem, do not put that singleton here!

◆ RemoveTicker()

void FTSTicker::RemoveTicker ( FDelegateHandle  Handle)
static

Removes a previously added ticker delegate.

Can be called concurrently. If is called in the middle of the delegate execution, it blocks until the execution finishes, and thus guarantees that the delegate won't be executed after the call.

Parameters
HandleThe handle of the ticker to remove.

◆ Reset()

void FTSTicker::Reset ( )

Resets the instance to its default state. Must be called from the ticking thread.

◆ Tick()

void FTSTicker::Tick ( float  DeltaTime)

Fire all tickers who have passed their delay and reschedule the ones that return true

Note: This reschedule has timer skew, meaning we always wait a full Delay period after each invocation even if we missed the last interval by a bit. For instance, setting a delay of 0.1 seconds will not necessarily fire the delegate 10 times per second, depending on the Tick() rate. What this DOES guarantee is that a delegate will never be called MORE FREQUENTLY than the Delay interval, regardless of how far we miss the scheduled interval.

Must not be called concurrently.

Parameters
DeltaTimetime that has passed since the last tick call

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