Unity’s Time
class is an easy way to get the relative time. You can find the time since the app started with Time.time
or the time between frames with Time.deltaTime
. But what if you want to know the absolute time? You may need to display a clock to the user, send a timestamp over a network, or record when a game was saved. This is where System.DateTime
comes in. It’s powerful and offers so much functionality that it’s natural to worry about about how slow it’ll be. So today’s article puts it to the test to find out how much time is being spent in operations like DateTime.Now
which gets the current date and time. Is it quick enough that you shouldn’t worry? Read on to find out.