title: Unity Slider decrease as timer
body: <p>I'm trying to make a countdown timer but using a Unity Slider instead of text but I've ran across a few issues. So my current code is:</p>
  
  <pre><code>using UnityEngine;
  using UnityEngine.UI;
  using System.Collections;
  
  public class CountdownTimer : MonoBehaviour {
      //public Text timeText;
  
      public float startingTime = 100.0f; 
      public Slider Timer;
  
      // Use this for initialization
      void Start () {
          Timer = GetComponent&lt;Slider&gt; ();
      }
  
      // Update is called once per frame
      void Update () {
  
          startingTime -= Time.deltaTime;
          Timer.value = startingTime;
  
          if (startingTime &lt;= 0)
          {       
              startingTime = 0;
              Application.LoadLevel ("GameOver");         
          }
      }
  }
  </code></pre>
  
  <p>This code works if I were to replace the slider with the text but not vice versa. My second issue is when I attach this code to my player and link the slider from the hierarchy, it disappears when I start the game.</p>
  
  <p>Last issue is when I try to add an On Value Changed, I can link it to my player to get the functions from the code but from doing my research there isn't really anything I can link it to since I only have start and update. Scrollbars can use private voids and receive the dynamic float that way but I haven't been able to yet with Sliders</p>
  
  <p>Example:
  <a href="http://i.stack.imgur.com/6EZp7.png" rel="nofollow">On Change Value</a></p>