PlayerPrefs & Time.time


I am trying to make a timer and to save/load it.
I use Time.time to format hh:mm:ss, which works.

I save the timer (hh:mm:ss) with no problem but I can’t load it in Time.time because Time.time is read only. So the timer restarts to 0.

I am supposed to do all this without Time.time for be able to load the timer or is there any solution to initiate time.time to the timer value.


Time.time is static and read only as you said. You may want to use the TimeSpan object to hold the Time.time, or just use a TimeSpan object since that would be easier. You can parse in the string and format it in and out however you like. TimeSpan also has convenience methods to help manipulate the TimeSpan object(add/subtract time and all that jazz)