I want to create a GUIText timer in Unity that displays minutes and seconds since the beginning of the level. I’ve tried using Time.deltaTime and Time.realtimeSinceStartup, but I could not get them to work. How would I script a timer in C#? Here’s where I got to:
public GUIText Timer;
void Start()
{
startTime = Time.time;
}
void Update()
{
newTime = Time.realtimeSinceStartup;
int absTime = Mathf.Abs(newTime);
int sec = absTime % 60;
int min = absTime / 60;
Timer.text = min + ":" + sec;
}