Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Lap timer

Discussion in 'Scripting' started by IISYNII, Feb 12, 2015.

  1. IISYNII

    IISYNII

    Joined:
    Feb 1, 2015
    Posts:
    8
    I know this topic has been done many times but i need help making a lap timer that starts and resets on a trigger
     
  2. Megolas

    Megolas

    Joined:
    Apr 6, 2013
    Posts:
    25
    When the game starts, save the time in milliseconds or seconds.
    You can do that using Time.realtimeSinceStartup.
    Next, set up a collider at the end of the track - when someone touches it, check what time is it again, subtract the starting time, and you have the amount of seconds the player took to make a full lap.