Hello!
I’d like to show, when the race is finished, what the difference is between the race time and the players best time. If the time is better than the previous time, then show the text in green color and vice versa when worse then red color.
How do I do that with float variables?
public bool finished = false;
public float raceTime = 0;
public float bestTime = 0;
if (finished && !PlayerPrefs.HasKey ("Best time 11") || finished && raceTime < bestTime) {
bestTime = raceTime;
PlayerPrefs.SetFloat ("Best time 11", bestTime);
} else {
bestTime = PlayerPrefs.GetFloat ("Best time 11", bestTime);
}