Time.time in Unity
Notes:
Time.time in Unity
- returns the time passed in seconds; since the game started
Time.time = Total game play time - Total game pause time
Note: is affected by Time.timeScale;
i.e. if game is paused then Time.time will also be paused and scales or descales according to Time.timeScale value
Application:
- to display a timer in the game
- to keep track of total game play time - the total game pause time etc.
Example Code:
void Start ()
{
Debug.Log ((int)Time.time);
}
void Update ()
{
Debug.Log ((int)Time.time);
}
void OnApplicationQuit()
{
Debug.Log ((int)Time.time);
}