Hi I’m making a Runner 3rd person game and when I was making the level complete loading screen for when you finish, also to display how much time you spent so that I can get speed runners interested. I was so Stuck on how to save and display your Best and current time on the loading screen. I’ve looked for tutorials and forums everywhere but for some reason I can’t find any on how to display current time and best time. here’s my code. Also I’m using a box collider so when the player hits it the loading screen shows up and they move to the next level.
void Start()
{
}
void Update()
{
currentTime = countUp ? currentTime += Time.deltaTime : currentTime -= Time.deltaTime;
timerText.text = currentTime.ToString(); // A ternary operator to increase and decrease current time
{
}
SetTimerText();
}
private void SetTimerText()
{
timerText.text = currentTime.ToString("0.00");
}
}