Keyboard event for GUI

Is it possible to dispatch gui events using the keyboard and not the mouse? How can I set the boolean of the GUI.Button to true by using the keyboard? Thank you.

You can’t really, but just do something like

function OnGUI () {
	var keyPressed = (Event.current.type == EventType.KeyDown  Event.current.keyCode == KeyCode.B)? true : false;
	if (GUILayout.Button("Click me!") || keyPressed) print ("Button clicked");
}

–Eric