title: How do I play an animation for twenty-seven seconds or more and load a scene in unity3d
body: <p>Right now I have the script set to switch scenes when the players health gets low. I want is the die animation to play first than scene load after twenty-eight seconds . I am going to trigger the die animation . The die animation clip is 26.0 . The load scene the going to be gameover scene . The gameover scene needs to load  28.0 or 29.0 . Somewhere around their . Here is my code :</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using UnityEngine.UI;
  using UnityEngine.SceneManagement;
  
  [System.Serializable]
  [RequireComponent(typeof(SpriteDatabase))]
  public class Healthbar : MonoBehaviour {
  
  
      public int fontSize;
  
      public static int playersHealth;
  
      public int health;
      int healthNormalized;
      GameObject player;
  
      Image frame;
      Image bar;
  
      public int displayCritical;
      public int displayRedBar;
      public int displayYellowBar;
      public string healthMessage;
      public string criticalMessage = "Critical";
      public string playerTag;
  
      Text Message;
      Text Critical;
  
      public bool showHealthValue;
      public bool showCritical;
  
      public string sceneToLoad = "T";
  
      SpriteDatabase sd;
  
      public Theme chosenTheme;
      public FontNames chosenFont;
  
      int myTheme;
      int myFontTheme;
  
      public enum Positioning {
          TopLeft,
          TopRight,
          BottomLeft,
          BottomRight
      }
  
      [HideInInspector]
      public bool alive = true;
  
      //For demo purposes, store player's initial transform (so later it can be respawned there)
      Vector3 startPos;
  
      //used to choose between left or right alignment
      public Positioning positioning;
  
      //On Start, assign SpriteDatabse class to 'sd'. (Note: That class can never be missing due to the dependency system)
      //It then runs Debugger() (find it below.) It checks whether the required sprites are assigned in the inspector, etc.
      //Then, it builds hierarchy for GUI (find below)
      void Start(){
          sd = GetComponent&lt;SpriteDatabase&gt;();
          fontSize = Mathf.Clamp(fontSize, 5, 30);
          Debugger();
          BuildHierarchy();
          startPos = player.transform.position;
      }
  
  
      //Converts health integer to float value and updates it every frame.
      //Keeps the GUI bar (image) fill amount value synchronized with the health value.
      //Note: healthNormalized cuts the number so that it's on a 100 scale like in every game (it's basically the percentage)
      void FixedUpdate(){
  
          if (player) {
              if (alive) {
  /*
                  if (healthNormalized &lt;= 0) {
                      alive = false;
                      die();  
                  }
  */
                  healthNormalized = health/10;
                  //Converts health value to a float (range 0-1) so it can be used for image.fillamount
                  float healthValue = health * 0.001f;
                  healthValue = Mathf.Clamp(healthValue, 0, 1);
  
                  //Checks if it's time to turn the bar color to red or yellow (replace the sprite basically)
                  CheckForBarColor();
  
                  bar.fillAmount = healthValue;
              }
  
              DisplayText();
  
          }
          else
              player = GameObject.FindGameObjectWithTag("Player");
      }
  
      void DisplayText(){
          if (showHealthValue)
              Message.text = healthMessage + ": " + healthNormalized.ToString();
          if (healthNormalized &lt;= displayCritical &amp;&amp; alive &amp;&amp; showCritical) {
              Critical.enabled = true;
          }
          else
              Critical.enabled = false;
      }
  
      //Called by every object affecting player's health.
      //Class that calls it: ApplyDamage
      //See that for more info on how to use it!
      public void ModifyHealth(int amount) {
          if (alive)
              health = health - amount;
  
          if  (health &lt;= 0) {
              Debug.Log("1: sceneToLoad = " + sceneToLoad);
              if  ((sceneToLoad != "") &amp;&amp; (SceneManager.GetSceneByName(sceneToLoad) != null)) {
                  Debug.Log("2: sceneToLoad = " + sceneToLoad);
                  SceneManager.LoadScene(sceneToLoad);
              }
          }
          else {
              health = Mathf.Clamp(health, 0, 1000);
          }
       }
      }
  </code></pre>