Text Prompt Problem

I’m having a problem trying to get this object to be interactive in this environment I am building. When you approach a sign with this “wanderer_figure” I want a prompt to pop up within the GUI layer asking the player to press space to activate further text to be shown. Right now I have it coded as such:

var showGUI : boolean = false; 
var customGUI : GUISkin;

function OnTriggerEnter (myTrigger : Collider) {
 	if (myTrigger.gameObject.name == "Wanderer_Figure"){
		showGUI = true;
		}   
}

function OnTriggerExit (myTrigger : Collider) {
	if (myTrigger.gameObject.name == "Wanderer_Figure"){
		showGUI = false;
		} 
}

function OnGUI() {
//activate custom skin settings/textures
	GUI.skin = customGUI;
	if(showGUI){
		GUI.Box (Rect (Screen.width/2-100, Screen.height/2+200,200,100), "Press SPACE to Interact");
	}

	if (Input.GetKeyDown ("space")){
		showGUI = false;
		GUI.TextField (Rect (Screen.width/2-100, Screen.height/2+200, 400,200), "TEST");
	}
}

However, when I try and test this code, the second half of the GetKeyDown call doesn’t work, even if I hold down the space key. I’m trying to see what the problem, and also am wondering how I might make this second set of text disappear after a certain period of time (or else disappear based on more user input).

I’m kind of a n00b at this, so any help would be greatly appreciated, and thorough explanation of any tips would would equally be extremely helpful!

GetKeyDown only returns true for one frame, so the textfield will only appear for one frame. Although GetKey shouldn’t be used in OnGUI, use Event.current.type == EventType.KeyDown instead. You can use that to toggle a boolean which would dictate whether the textfield is used or not.