Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 863 Bytes

Devices.md

File metadata and controls

25 lines (16 loc) · 863 Bytes

Detecting Devices

Connect your input indicators to the device_changed signal to be notified when the player uses a new input device. For example:

func _ready() -> void:
    InputHelper.connect("device_changed", self, "_on_input_device_changed")


func _on_input_device_changed(device: String, device_index: int) -> void:
    print("XBox? ", device == InputHelper.DEVICE_XBOX_CONTROLLER)
    print("Device index? ", device_index) # Probably 0

You can also try to guess the controller before any input is registered (thanks @_was):

InputHelper.guess_device_name() # Maybe "xbox" if you have an XBox controller plugged in

To remap input, have a look at Input Mapping.

Device Tester

Run the res://addons/input_helper/device_tester/device_tester.tscn scene to test inputs.