- Home /
Navigating a gui with the keyboard
Hi, I am trying to make a menu for my game using the new Unity UI system implemented in version 4.6. I want this to work with both mouse and keyboard but I don't know enough about the ui system yet to understand how to do this.
What I am trying to do is when you press the up or down key you will select the different buttons in the menu and when pressing enter or space it will "click" that button. Is this something that can be done without too much fiddling.
Answer by Mmmpies · Mar 01, 2015 at 10:21 AM
You need to look at the Navigation part of the buttons. set it to automatic and it should take care of an easy set of buttons.
I've got mine set to none because I don't want the HUD buttons reacting the player movement but you can just play with the settings, Automatic will probably fix what you want instantly though.
Click on visualize and it'll show arrows on the canvas displaying which button links to which.
Answer by Rolum · Mar 02, 2015 at 03:08 AM
Check the EventSystem that was created along with your canvas, you can drag a button on "First selected" to make sure you won't have to click with the mouse before being able to move around with the keyboard.
Wow, I feel like a complete idiot now, after working a week only for scripting the menue. I should have read this earlier :/
What if I made a pause screen and didn't use a canvas? Do you know how that would work? Basically my pause menu has three buttons, but no canvas, and the menu works fine, but I can't navigate through the buttons without a mouse.
Your answer
Follow this Question
Related Questions
Controlling Pause Menu with Keyboard 2 Answers
Main Menu - One scene or multiple? 1 Answer
How to place/add a HD image/picture in background of my game? 0 Answers
Using keyboard with the GUI system 2 Answers