I was trying to figure out how to focus the next UI element from code for Godot 4.2.2, but I couldn’t find a suitable function on the Control
class. Looking at the Godot docs, it recommends creating an input event to send back to the game:
I tried this by changing the action to ui_focus_next
and it didn’t work when my UI was in a SubViewport
. I guessed that this was because the input event was being sent to the wrong SubViewport
and found this solution: