Keeping track of playtime

Hi,

I have been trying to figure out a way to keep track of playtime. I found that there is a timespan class that I thought might be the solution, but I can’t get it to increase by using the timespan + timespan function. It seems to always stay at 0:00:00, so I am not sure what this struct is used for and can’t find much information on it. I am currently trying by using my own struct of hours, minutes, seconds, and milliseconds, but this way seems tedious. Is there any easier way? Thanks in advance.

Bump! Also wondering this.

Hey Danielsh09-

The “Now” node will return a date/time structure that can be used to get the current time and date of the computer. This can be promoted to two variables (start time and elapsed time). Start time should be set at the beginning of play and elapsed time can be set as needed (at a checkpoint, save point, end of level, etc.). Adding a get node of these variables, you can then drag off and use a “Get Time of Day” node which returns the time elapsed since midnight and returns a timespan. A “Timespan - Timespan” node can then be used to get the total number of seconds between the two.

1 Like

Thank you!