title: Unity Countdown Script using Triggers for Start and Finish
body: <p>I am using the 3d Game Kit inside of Unity and trying to display a timer upon the player entering a trigger and then stopping the timer once they reach a ending trigger. The kit uses a dialogue canvas that I am unfamiliar with and trying to figure out.</p>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>I've got the timer now on my UI and can make it stop when entering a trigger, but Im not sure how to make it start when a player enters a trigger. Right now it is just starting whenever the game starts.</p>
  
  <pre class="lang-c# prettyprint-override"><code>public class Timer : MonoBehaviour 
  { 
      public Text timerText; 
      private float startTime; 
      private bool finished = false; 
  
      void Start () 
      { 
          float startTimer = Time.time; 
      } 
  
      void Update () 
      { 
          if (finished) return; 
  
          float t = Time.time - startTime; 
          string minutes = ((int)t / 60).ToString(); 
          string seconds = (t % 60).ToString("f2"); 
          timerText.text = minutes + ":" + seconds; 
      } 
  
      public void Finish() 
      { 
          finished = true; 
          timerText.color = Color.yellow; 
      } 
  }
  </code></pre>