Key for GUI.Button

I’m so frustrated so i hope you good people in the community can help :stuck_out_tongue: I want to make my two GUI.Buttons from the code below to activate with keys and i’ve done it before in simpler scripts but it just won’t work here! Any help? Thanks!

var Pressed : boolean = false;
var charPressed : boolean = false;

var guiRatio : float;
var sWidth : float;
var GUIsF : Vector3;

var cube : GameObject;
var check : boolean = false;

function Awake(){
	sWidth = Screen.width;
	guiRatio = sWidth / 1440;
	GUIsF = new Vector3(guiRatio,guiRatio,1);
}

function Update(){
	if(cube == null){
		check = true;
	}	
}				

function OnGUI(){
		if(check){
				GUI.matrix = Matrix4x4.TRS(new Vector3(Screen.width - 100*GUIsF.x,Screen.height - 60*GUIsF.y,0),Quaternion.identity,GUIsF);
				if(GUI.Button(new Rect(-20,-20,100,60),"Deer")){
					gameObject.GetComponent(CharacterMotor).jumping.baseHeight = gameObject.GetComponent(CharacterMotor).jumping.baseHeight + 3;
					Pressed = true;
						if(gameObject.GetComponent(CharacterMotor).jumping.baseHeight >= 4){
							gameObject.GetComponent(CharacterMotor).jumping.baseHeight = 4;
						}
					}
				}																					
				if(Pressed){
					GUI.matrix = Matrix4x4.TRS(new Vector3(Screen.width - 100*GUIsF.x,Screen.height - 60*GUIsF.y,0),Quaternion.identity,GUIsF);
					if(GUI.Button(new Rect(-20,-100,100,60),"Stop")){
						gameObject.GetComponent(CharacterMotor).jumping.baseHeight = 1;
						Pressed = !Pressed;
					}
				}
			}

On GUI.Button you have option to set a tooltip (good for hover effects) or set ID parameter! You can use ID for any button you have.

In my scripts every time i click in gui.button i send a message for all scripts who extends my other script, like this:

Events.ToList().ForEach(evt => evt.OnClickUIButton(ID));

Then in other script i have:

public void OnClickUIButton(string ID) {
	switch(ID) {
		case "PlayGame":
			// do same action
			break;
	}
}

Nevermind guys i just figured out what need to be done :stuck_out_tongue: Thanks for your replies anyway :stuck_out_tongue: