Use unity3d5.0 +ugui to make a useful game timer
First, the source code
[CSharp] View plain copy print? <summary> /// time:2014-4-8 /// author:gwl /// Description: This class is used to handle timing functions, including timing start, pause function /// </summary> using unityengine; using system.collections; using unityengine.ui; public class timer : monobehaviour { Total time of public float time_all = 300;//timing (in seconds) public float time_left;//Time remaining public bool ispausetime = false; public Text time; // Use this for initialization void start () { time_left = time_all; } // Update is called once per frame void Update () { if (! Ispausetime) { if (time_Left > 0) starttimer (); } } /// <summary> /// Start Timing /// </summary> void starttimer () { time_left -= time.deltatime; time.text = GetTime (time_left); } /// <summary> ///continue the game, this is temporarily added here, later code refactoring when added in Uicontrol /// </summary> public void continuegame () { isPauseTime = false; Time.timeScale = 1; } /// <summary> /// Pause Timings /// </summary> &nbsP; public void pausetimer () { isPauseTime = true; time.timescale = 0; } /// <summary>