title: Save Timer HighScore
body: <p>I am currently working on a game were it has a timer go and the best time is the one that can complete the course the quickest. For example, the first run if I get 40 seconds that will be saved as the high score but if the second run I get 30 seconds that will be the new high score. My app currently does the opposite were if I get a higher time that will be the new high score.</p>
  
  <p>Notes: Yes I have tried to switch the sign to less than '(t &lt; PlayerPrefs.GetFloat ("HighScore", 0))' but the issue then is that no time can beat "0" as a high score.</p>
  
  <p><strong>Source Code C#:</strong></p>
  
  <pre><code>using System.Collections; 
  using System.Collections.Generic; 
  using UnityEngine; 
  using UnityEngine.UI; 
  using UnityEngine.Internal;
  
  public class TImer : MonoBehaviour {
  
   public Text timerText;
   public Text highscore;
   private float startTime;
   private bool finished = false;
  
  
  
   void Start () {
  
       startTime = Time.time;
       highscore.text = PlayerPrefs.GetFloat ("HighScore", 0).ToString();
   }
  
  
  
  
   void Update ()
   {
  
       float t = Time.time - startTime;
       string minutes = ((int)t / 60).ToString ();
       string seconds = (t % 60).ToString ("f2");
       timerText.text = minutes + ":" + seconds;
       if (t &gt; PlayerPrefs.GetFloat ("HighScore", 0)) {
           PlayerPrefs.SetFloat ("HighScore", t);
           highscore.text = t.ToString ();
       } 
  }
  </code></pre>