Iam trying to create a timer so when it reaches 0 it loads a new level sort of like a loading screen I think there's something wrong with my code

#pragma strict
var myTimer : float = 5.0;
function Start () {

}
function Update () {
  myTimer -=Time.deltaTime;

   if (myTimer == 0) {
     Application.LoadLevel(1.5);
}
}

Hello,

Your problem is that myTimer will never directly equal 0:
Lets say it’s very close to 0, at 0.05 and you have very bad framerate, so your delta time is 0.06. After your code is run, myTimer will equal to -0.01 and has, quite literally, skipped 0.

To avoid this, you should, instead of checking for equality, compare size: myTimer < 0

Hope this helps,
Benproductions1

Time.deltaTime is a fraction that varies from frame to frame. The chance that you will hit 0.0 exactly is very small. So you should change it to:

  if (myTimer <= 0.0) {
     Application.LoadLevel(1.5);
  }