Found a script that can get the time that has passed in a game and show it. This would be super ideal for a racing game, and you could tweak it for time attack modes or something else of the sort!

using UnityEngine;
 
public class GetTimeString : MonoBehaviour {
    float startTime;
    float time = 0.0f;
 
    void Start () {
        startTime = Time.time;
    }
 
    void Update () {
        time = Time.time - startTime;
        Print(FormatTime(time));
    }
}

 

Leave a Reply