public void Finish() { finishTime = TimeFromStart(); if (!PlayerPrefs.HasKey(CourseKey + "_" + "record") || finishTime < PlayerPrefs.GetFloat(CourseKey + "_" + "record")) { for (int i = 1; i < times.Count; i++) { PlayerPrefs.SetFloat(CourseKey + "_" + i.ToString(), times[i]); } PlayerPrefs.SetFloat(CourseKey + "_" + times.Count.ToString(), finishTime); PlayerPrefs.Save(); timerUI.Finished(); PlayerPrefs.SetFloat(CourseKey + "_" + "record", finishTime); PlayerPrefs.Save(); GetComponent <MenuUI>().HighScoreSet(); } else { timerUI.Finished(); } }