How to you approach making a controller navigatable ui?

Ive been thinking on how to make my game ui work with a keyboard/controller. But i kinda dont know how the code would work.

You would actually need only two lines of code to initialize focus to the first button.

func _ready():
	$StartButton.grab_focus()

Then keyboard/controller input that switches between control nodes comes right out of the box in Godot. You can also assign neighbours or next/previous control nodes to assign specific targets.

image

Check out Keyboard/Controller Navigation and Focus — Godot Engine (stable) documentation in English for more.

2 Likes

Oh thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.