Using keyboard with the GUI system

I’ll just make this short. From all I’ve gathered so far, there isn’t a way to use the keyboard with Unity’s GUI system. However, just to be sure, am I right?

What exactly are you trying to do?

Make a menu that works with the keyboard rather than the mouse! Having to use the mouse with in-game menus is such a pain.

2 Answers

2

I thought that GUIUtility could help, but it either can’t or I don’t understand it.
Either way, using custom GUIStyle-s that don’t show like visual feedback that the mouse is over the element so no 2 elements appear active at the same time for example. And for the inactive elements I used another style. The keyboard controls were done simply using the Input class, with all the elements stored in an array in an order that represented their order in which control should jump between them. Used custom structs, function references (delegates in C#) and some other stuff. Anyway I think it was a good idea though still a bit hardcoded.
Also I haven’t implemented functionality for all the various kinds of GUIElements provided. Haven’t made (it) into a custom GUI kit (yet), but for a 1-time use it was sufficient and pretty doable.

Check out the many free GUI extensions, they might also have sg. wise to say about this.

I don’t whether the guys at Unity plan to do anything about the whole GUI creation. If they do, then you could just wait :smiley:

It's a common request and is, it would appear, being addressed: http://feedback.unity3d.com/forums/15792-unity The #2 requested feature as of now.

Yep, that's what we're gonna have to do... A real pain, though. Keeps reminding me of UDK's sweeeeet GUI editor! :D tnx for the info anyway.

See Event.

e.g. (from docs)

void OnGUI()
{
  Event e = Event.current;
  if( e.isKey )
  {
    Debug.Log("Detected character: " + e.character);
  }
}

This is very clever. So can you tell me how to fix it? Because i'm lost.

Try In TryAgain() Grab script in witch is giving you error And set it don't destroy on load as written above