I’m using Time.time to get the seconds since the game loaded, and calculating minutes, hours, and days with it. But I read Time.time varies depending on the performance of the computer.
Is that only frame rate related, or is it something I need to worry about it, since my game depends so much on an internal clock?
I also have gameObjects (characters) that run on their own internal clocks, which hopefully I’ll be able to use to calculate their “age”.
If you want the time to be exactly the same as the real time it would be easier. However if you want to just get the time since the start you could just store the starting time and calculate against that.
I’m calculating from the start of the game. Thought Time.time would work…and it is, but I was wondering if my method was an efficient one. This is how I’m doing it:
From what I understand that is completely fine. Since Time.time returns the seconds since the start of the game… However it seems like if you do mess with Time.timeScale it will effect this time. Which probably isn’t bad if your doing like a day cycle or something and the player pauses the game.
I don’t know about effeciency, but it would probably be more understandable (and thus more maintainable) to use System.TimeSpan to do all the calculations.