Different input methods in menus

Godot Version

4.5.1

Question

Hey all, I’m looking for a bit of general guidance when it comes to the different _input virtual methods. I’ve read the documentation and looked through some of the UI demos from GitHub, and I understand the basic concepts of them but was looking for some extra guidance.

I have a working button remapping menu, and I can use _input or _unhandled_input along with the _toggled to remap and swap buttons. I was reading about the _input styles and thought about using _gui_input, but then looking at the button remapping demo on GitHub, it also uses _unhandled_input for this and not _gui_input.

For what I am planning, I intend the players to use a gamepad predominantly, and they could also just use the keyboard if they have no gamepad, but I don’t intend for any mouse functionality in gameplay. Is _gui_input mostly for using the mouse/pointer and clicking on objects? From the documentation it seems to be somewhat focused towards that, but I’m sure it could be used in a lot of ways.

Should a button remapping (or any settings) menu use _gui_input predominantly, or is using the other input methods viable? If they are viable, I’d assume for menus I would want to use _input ahead of _unhandled_input since I would be reserving _unhandled_input for character gameplay.

Yes _gui_input is almost exclusively mouse interactions.

_unhandled_input is almost always better than _input, even for menus. It gives you more control over which nodes receive the input and can prevent multiple nodes from responding to the action where only one menu/node should.


This docs page explains the sequence an input travels through. It’s good for your code to be near the end of the list (with _unhandled_input at 7th place) so that it’s firing under the proper controlled conditions, the higher up the list the less options you have to interrupt when it shouldn’t fire.

I always reach for _unhandled_input first, I think I’ve only used _gui_input for GraphEdit nodes and plugins personally, and _input for keyboard related animations in a typing game that should always trigger.

2 Likes