Quick Question?

Can you use the same FTimerHandle for calling two different functions at set time intervals from each other and if not why?(I’m calling a function once using a timer in BeginPlay and then calling a different function with a timer in Tick) Also is it bad calling a timer in the tick function even though I’m having no delay on it except the first iteration?

Hi @ShadowSprite123

Just in case, you cannot call a SetTimer with 0.0f execution time. It gets automatically consumed and discarded.

Once a FTimerHandle is set, it’s bound to the last event you assigned to it. So you can use the same FTimerHandle as many times as you want, but calling SetTimer on it before the last event is executed will override the event assigned and dispose of the previous one.

Summary: Time must be greater than 0.0f and FTimerHandle can only hold one event at a time.

As for the Tick, I don’t imagine a situation in which using the Tick to handle Timers is the best solution. In general I wouldn’t recommend it.

If you’re calling SetTimer every Tick, you’re killing the timer.
If you’re using a condition to determine when the timer should be set, you can probably use a Delegate at the right place or a condition on the right function, not connected to the Tick.

As a general rule, Tick should be used to update things that require frame consistant updates and nothing else.

Things that can be updated every 0.2 seconds or even less can be set with a looping timer once or turn it on and off when necessary.

Things that react to something happening can be linked to a Delegate, a function, a trigger, …