Open GUI Window with Keyboard

Using frankenstein code I was able to create a menu to pop up when I reach a specific area of the scene. Great! The problem I am running into now is that in order to use the mouse to control the menu the camera is zooming all over the place (because the code it is attached to the main controller). If I could only get the keyboard to interact with the menu then that would solve my problem.

My scene can be found at http://www.eringilman.com/Buku/

Walk into the middle of the room and you will see what I am talking about. Here is the code I am using…

private var GetKeyDown : boolean;
private var windowOn : boolean;
private var windowRect : Rect = Rect (150, 150, 120, 50);//window parameters


function OnTriggerEnter (other : Collider) {
        buttonOn = true;
    }

function OnTriggerExit (other : Collider) {
        buttonOn = false;
    }

 				if (Input.GetKeyDown ("b") (Rect (50, 50, 100, 30), "WindowOn")) {
                        windowOn = true;
                }

                if (GUI.Button (Rect (25, 100, 100, 30), "Turn Window Off")) {
                        windowOn = false;
                }

                if (windowOn == true) {
                        windowRect = GUI.Window (0, windowRect, WindowFunction, "My Window");
                }
        }       
        //take this "else-statement out if you want the activation of the window to be remembered, even if you leave the proximity of the object
        else {
                windowOn = false;
        }

    }

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

Hi, welcome to the forum!

There appears to be code missing from what you posted (it wouldn’t work as it is). Can you post the whole script?