Script is not loaded every time the scene is

This script runs once the scene runs, but only the first time, is it possible to make it run every time the scene is loaded?

#pragma strict
var someText : GameObject;
function OnGUI () {
GUI.skin.label.fontSize = Screen.width / 100;
//GUI.Label (Rect (Screen.width / 2, Screen.height / 2 - Screen.height / 3,120,50), "Story");
GUI.Label (Rect (Screen.width / 2 - Screen.width / 7, Screen.height / 2 - Screen.height / 10, Screen.width / 3, Screen.height / 3), "", GUI.skin.label);
}

function Update () {

}

function Awake () {
Screen.showCursor = false;
wait();
}


function wait() {
Debug.Log("waiting");
yield  WaitForSeconds(10);
Debug.Log("loading");
Application.LoadLevel ("scene2");
}

I think what you are trying to achieve is having a loading screen between loading the levels(scenes) and you want to persist the state of this script on to the next level.

So i’m going to tell you of another way to achieve this goal.

  1. Store the number of the level you are trying to load in a script on a game object in a scene
  2. Add the DontDestoryOnLoad(this) for this game object. This would keep the game object when you load the new scene.
  3. Load the loading screen scene
  4. The loading screen scene will now have access to the game object we passed through from step 2
  5. Now you can access the level number that we stored in step 1 and load the next level
  6. Before you load, make sure to Destory the game object that stores the next level value so that we don’t have duplicates when we load the later levels.

I confirm that this works because I use it to load the levels in my game.