The Basics of Time in Unity

Previously, I mentioned the functionality of Time.deltaTime in Unity, being to convert frame time to real time. As it turns out Time.Time in Unity provides the actual real time, and can be recorded to a variable to remember how long ago a thing happened.

A good example of recording time stamps is limiting the fire rate for weapons

As you can see in this example, all we have to do is compare the fire rate of our weapon with the difference between the current time and the last time we fired, and know whether we are ready to fire again or not. This kind of very basic feature should be easily accessible in any game engine, and it is nice to see this is the case for Unity.