Files
racesm/Assets/Scripts/LapTimer.cs

33 lines
521 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LapTimer : MonoBehaviour
{
public float time = 0;
private bool startTime = false;
private void OnTriggerEnter(Collider other) {
if (startTime)
{
startTime = false;
print(time);
} else {
startTime = true;
time=0;
}
}
void FixedUpdate()
{
time +=1;
}
}