When moving WASD, button is not focus by cursor in Node2d

Godot Version

4.3

Question

  • root
    • node2d
      • button
      • button
    • camera2d
    • CanvasLayer

When I move the cursor


, the buttons are highlighted correctly. but when I use the WASD keys, the event processing does not occur. I did not find a solution in the GODOT documentation either. Can someone tell me?

Because W,A,S,D are not default UI keys. The arrow keys are. What led you to believe the W,A,S,D would work?

If you look at the input map in the project settings, there’s a switch you can throw to let you see the default bindings, and I believe you can edit them; you could potentially add w to ui_up and so forth, just bear in mind that will potentially interfere with controls that expect text input like LineEdit.

You could also use grab_focus() to take control of button focus yourself…

Personally, the only ui action I ever change is ui_accept where I add the controller’s lower action button. While you can change these th documentation recommends not doing that. and as @hexgrid points out

i find Solution
When processing keyboard events, send a signal

Input.ParseInputEvent(new InputEventMouseMotion())

Thank you all for your help

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