Take the 2-minute tour ×

As I'm new to the coding and unity3d I'm finding tough to set the lap timer for my racing game which is the multiplayer game.

share|improve this question
The unity tag is for Microsoft Unity. Please don't misuse it. –  Lex Li Dec 31 '12 at 12:10
add comment

1 Answer

Well in terms of just code.


Will give you the time (duh)

So you'd do something like the following

function Awake() {
    startTime = Time.time;

function OnGUI () {
   var currentLap = Time.time - startTime;

currentLap is the current time since the script started. So you could run the code in the "Awake()" method when the race starts. Then on screen display what the current lap time is.

Found a nice example from the Unity Developer Network that might be exactly what your looking for here

share|improve this answer
add comment

Your Answer


