UE4 Ticks, Timelines, and Timers

A comparison between these three and explaining their use cases

Gameinspired
3 min readJan 1, 2021

You shouldn’t use Ticks

I have read this sentence countless times. It is a widespread assumption so many developers simply accept it as true. But is it?

Let’s take a closer look at the Tick event and its alternatives.

It’s time to do the Tick it’s justice.

The Tick

First, let’s clear up what the Tick is, and what it does.

The Tick event is executed on regular intervals-usually once per frame, in an actor or component.

You can change the Tick interval with the Tick Interval (secs) option under Actor Tick.

Ticks are assigned to a Tick Group. Which determines when during the frame the actor/component ticks.

Different tick groups

The Tick Group defaults to PrePhysics, which is fine in cases where the actor should interact with physical objects. This way, the actor’s logic is completed when the physic calculation starts.

Some actors might need a different group, depending on their use case. But I wouldn’t waste too much time on this. PrePhysics is fine in the majority of cases. However, It is good to have this knowledge in mind.

Prerequisite

If you have an actor, which depends on the data of a different actor, you can use the Add Tick Prerequisite Actor function to ensure that this actor only ticks after the prerequisite Actor.

This actor will tick after the sphere actor.

Ticks, Timers, and Timelines

The two alternatives to Ticks are Timelines and Timers. Here is an overview to know when to use what.

Avoid checking intervals

On a side note, using intervals to check the state of something can often be optimized using custom Events.

Here is an example:

Example of custom Events.
CheckOverlapped Function.

Instead of checking every X-interval if the actor overlaps with the Sphere actor, we created a custom event which is called when the actors overlap.

What to do

The Tick event is not necessarily bad, but can often be replaced with a better alternative. Take a look at your ticks and ask yourself if you need to check the code every frame, all the time. If not, make use of timers, timelines, or custom events.

If there is a case when you need to tick every frame, do it. And don’t ever feel bad about it.

Optimization is a complex topic. If you experience performance problems in your game, replacing ticks with timers probably won’t help much.

This is all for today. Are you using ticks, or do you completely banned them from your toolbox?

Originally published at https://gameinspired.substack.com.

--

--

Gameinspired

A place to learn, grow and connect about game development. Find out more at: https://gameinspired.substack.com