Loading a scene in game with a GUI

I’m testing some things with unity right now, and I am trying to make it possible to load anther scene by walking into a collision box that is a trigger, after doing this a GUI should pop up saying press E to enter, However nothing happens with you enter the box. What is wrong?

#pragma strict

var theDoor : Transform;
private var drawGUI = false;
var Scene : int = 0;
 
function Update () 
{
    if (drawGUI == true && Input.GetKeyDown(KeyCode.E))
    {
       Application.LoadLevel(Scene);
    }
}
 
function OnTriggerEnter (theCollider : Collider)
{
    if (theCollider.tag == "Player")
    {
       drawGUI = true;
    }
}
 
function OnTriggerExit (theCollider : Collider)
{
    if (theCollider.tag == "Player")
    {
       drawGUI = false;
    }
}
 
function OnGUI ()
{
    if (drawGUI == true)
    {
       GUI.Box (Rect (Screen.width*0.5-51, 200, 102, 22), "Press E to open");
    }
}

Hmm, from my knowledge it seems that you may of not set the collider to trigger? If you have done this then maybe you have forgot to tag the player? Hope this helps :slight_smile: