Press Keyboard Instead Of Mouse

Been fighting with this for a couple of weeks now, thought I would ask one more time with updated code. I trigger a object by "walking" into which brings up a menu item. Instead of having to move the mouse (and camera) to press the button it would be nice to have the user press any key on the keyboard.

Any help would be appreciated.

var targetObj : GameObject;//drag your target into this slot in the editor var proximity : float = 3;//change trigger proximity here or in editor private var buttonOn : boolean; var customButton : GUIStyle;

function OnTriggerEnter (other : Collider) { buttonOn = true; GetComponent(MouseLook).enabled = false; }

function OnTriggerExit (other : Collider) { buttonOn = false; GetComponent(MouseLook).enabled = true; }

function OnGUI () {

    if (buttonOn == true) {

        GUI.Box (Rect (450,0,400,125), "BUKU MALL NAVIGATION"); 

            if (GUI.Button (Rect (500,25,300,75), "Click Here To Go To The Main Courtyard")) 
            {
                     Application.LoadLevel(1);
            }

                        } 

}

function WindowFunction (windowID : int) { // Draw any Controls inside the window here }

adding in function update of your script something like

if..... Input.anyKey or Input.anyKeyDown ? haven't tried it ...

Edit... i think this could work ...

function Update () {
    if ((Input.anyKeyDown)&&(buttonOn==true)) {

buttonOn = false;
Application.LoadLevel(1);
    }
}

You can just add the key check alongside the button press check, like so.

if (buttonOn == true) 
{
    GUI.Box (Rect (450,0,400,125), "BUKU MALL NAVIGATION"); 
    if (Input.anyKeyDown || GUI.Button (Rect (500,25,300,75), "Click Here To Go To The Main Courtyard")) 
    {
        Application.LoadLevel(1);
    }
} 

If this doesn't work I would assume that you haven't set buttonOn properly. Which could be because you dont have access to it in this script.