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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -