Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | MiroslavH |
What we have
- Player in Spleet Screen game (one pc multiplayer).
- Individual Consoles for Players
Console opens ui menu for Player.
1. How to set individual input map for ui menu and control him ?
2. How to controll menus (individual ui node) from Player Gamepad?
ps. need i create custom input system for that? or i can change default ui inputs and set players gamepad inputs map?
For now my solution is:
- Created an Array of UI elements and set the grab_focus() method.
- Listening for input from a player controller.
- Setting a new focus for an element based on the key pressed
var conroller := "_joy0" # it's doesn't matter for now
func _unhandled_input(event: InputEvent) -> void:
if menu_is_opened and event is InputEventJoypadButton:
if Input.is_action_just_pressed("down%s"%conroller):
get_focus_owner().find_next_valid_focus().grab_focus()
if Input.is_action_just_pressed("up%s"%conroller):
get_focus_owner().find_prev_valid_focus().grab_focus()
MiroslavH | 2023-03-26 17:07