Is this layout efficient or optimized?

Yes this is a good approach, ticks are evaluated every frame, using a timer instead so it is only evaluated as often as strictly necessary is a decent approach. And if your actor is not ticking you avoid the tick overhead mentioned in Ari’s video (which doesn’t really matter much because it’s a very small overhead)

For your function i think it might be overkill though, it’s fine to put on tick because all you’re doing is just setting a variable, which is quite cheap.

All the things Ari says in the vid nande linked to about tick are true… And it explained a lot of the reasons why you shouldn’t use tick quite well, while saying you should use tick. Tick should be used responsibly, it exists for a reason.

If you have an action you need to happen every frame, you put it on the tick. You just need to optimize it in such a way that only the parts that need to happen every frame run on the tick so that it won’t slow your game down.

You very much should not use tick if you do not need to use tick. Sometimes you need to use tick.

1 Like