unity3d - How to make stopwatch in unity (c#) -


hello don't know how make stopwatch in unity. make stopwatch count on scene(on top), show time in other scene(win scene) , save best result. stopwatch should start when load scene(on start method) , end when object collides collider. can me out?

public text timertext;     private float starttime;     private bool finnished = false;     // use initialization     void start () {         starttime = time.time;     }      // update called once per frame     void update () {         float t = time.time - starttime;         string minutes = ((int)t / 60).tostring ();         string seconds = (t % 60).tostring("f1");          timertext.text = minutes + ":" + seconds;      } } 

so made stopwatch (timer counts upwards). don't know how stop stopwatch when collides collider , present time in next scene.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -