Changes to actor ticking in 4.2 -- how to handle?

Before 4.2, we would set

PrimaryActorTick.bCanEverTick = true;

in any actor that needed to tick, and all of our various actor Tick() functions would get called whether or not the player paused the game. If the game was paused, the time delta passed in was very tiny; otherwise, we’d get the time delta multiplied by the current game speed.

After 4.2, we found that our actors were no longer ticked when paused, so we set

PrimaryActorTick.bTickEvenWhenPaused = true;

This seemed like a step forward at first, but it did not lead to the same behavior; it looks like when the game is paused, we now get the actual game speed passed in to the Tick() function.

Shouldn’t the time delta actually be 0 when the game is paused? Otherwise, the time delta getting passed in doesn’t properly represent either the actual time step or the game time step.

Alternatively, have you considered adding a separate “real-time tick” function (say, TickRealTime()) that would be identical to Tick(), but would always pass in the ACTUAL seconds that have passed since the last call to TickRealTime()? That way, any actors that needed real-time ticking could do so separately from game-time ticking.

Because really, real-time and game-time are two separate things and should be trackable independently.

This is important for us, since in our game (as with, say, SimCity, Caesar II, Tropico, etc), the player can set the game speed to 0x, 1x, 2x, or 4x using game-speed buttons in the UI. And while most things need to update with the game speed, other things (UI things and visual effect related things) need to always update based on the actual time elapsed.

Bumping this, I can’t wait to hear the answer to this

:slight_smile:

Hi Mothership,

To help us reproduce this issue, could you try to replicate this in a new project from one of the templates and just put enough functionality in to demonstrate what you are seeing? If you could then let us know how you set it up so we are able to reproduce it, we can try to figure out what is happening with the Tick.

Thanks, . I’ll see if I can find the time to reproduce it.

Basically, we’re using UGameplayStatics::SetGlobalTimeDilation() to set the game speed and UGameplayStatics::SetGamePaused() to pause or unpause the game.

It’s not holding us up at this point, though; we’ve just added an extra check to see if the game is paused inside our actors’ tick functions.