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 }