I tried to get time the game has not been running.
So First, I get the time when the player game quit
Next, If record is exist → currently time - exit time through I tried to get the time the game has not been running
But It’s not working
I tried to get time the game has not been running.
But It’s not working
You need Saving and Loading Your Game | Unreal Engine 4.27 Documentation To store variables between game sessions.
I just implemented it
However, when I do (current time-end time), the result is constantly changing.
Is it possible to make that result value fixed?
Share your new blueprint implementation and lets see if we can help.
… but taking a guess: what you need is to split the time struct and do the math yourself… something like
((CurrentHour * 60 + CurrentMinute) * 60 + CurrentSecond) - ((ExitHour*60 + ExitMinute) * 60 + ExitSecond)
After you get the total seconds between sessions, turn them back to h : min : sec
Youll need to be creative to know when its passed midnight.
Nothing change between current and question blueprint image
Just added the function that variable save and load
The node of “Now” is keep changing so I think I must be do something
Read this
When the game is closed, all variables are erased. You need to create a save and store the variable there, then load it when the game begins.
Where is that in your blueprint?
The current problem is that the end time is fixed so that doesn’t matter, but the current time fetched from the “Now” node is constantly changing.
What?
Just use BeginPlay and delete both tick and DoOnce.