What's wrong with my time system with Timeline?

Hello! It’s my first topic here, and I’d like to say that I’m a begginer on UE and I apprecciate your time if you can help me.

I’m trying to create a system time with sun light rotation with Timeline. I’m using timeline because before this approach I was using event tick, and I saw some inconsistencies because of FPS, for example: my game time was not synchronized with the sun’s rotation after a few minutes. (I know, maybe I have FPS issues to explore).

My problem is specifically when I try to load the timeline data (from the load game) to restore the time of the game. And the interesting thing is that the sun rotation is correctly restored, but the game time is not. Something happens that the time is always incrementing some hours or days when I restart the game.

I have a sun light who starts in this rotation:
image

A timeline with duration 60s (this is the length of the day in my game. It’s short just to test it), who starts in time 0, value -90, and finish in time 60 value 270.

I call the timeline in the event begin play:
image

First part of the method:

Second part:


After the “seconds” node I just use the timestam to show the time/day on HUD.

And to save in my save game, I save all the variables and restore all of them in the load game.

Again, the problem is: the sun rotation is correctly restored, and starts to rotate correctly. But the time is always incrementing hours and days…

This is my load method:

Please don’t judge me if I made some big mistake, I’m learning :slight_smile:

Thank you!

1 Like

Why not just save the timeline position in the save game? Then you can just recalculate all your variables in the next frame after load :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.