Skip to content

Instantly share code, notes, and snippets.

@d4rkd0s
Created August 27, 2025 21:26
Show Gist options
  • Select an option

  • Save d4rkd0s/140770bd62e616eb8177fb502ad4d2fd to your computer and use it in GitHub Desktop.

Select an option

Save d4rkd0s/140770bd62e616eb8177fb502ad4d2fd to your computer and use it in GitHub Desktop.
extends Node2D
func _ready():
print("=== Controller Debug Information ===")
# Check how many controllers are connected
var joy_count = Input.get_connected_joypads().size()
print("Number of connected joypads: ", joy_count)
if joy_count == 0:
print("No controllers detected!")
return
# List all connected controllers
var connected_joypads = Input.get_connected_joypads()
print("Connected joypads: ", connected_joypads)
# Check each connected controller
for i in range(connected_joypads.size()):
var device_id = connected_joypads[i]
print("\n--- Device ", device_id, " ---")
print("Name: ", Input.get_joy_name(device_id))
print("GUID: ", Input.get_joy_guid(device_id))
# Check available axes and buttons
var axis_count = 0
var button_count = 0
# Test how many axes are available (most controllers have 6-10)
for axis in range(10):
var value = Input.get_joy_axis(device_id, axis)
if value != 0.0 or axis < 6: # Assume first 6 axes exist even if at 0
axis_count = axis + 1
# Test how many buttons are available
for button in range(20):
if Input.is_joy_button_pressed(device_id, button):
button_count = max(button_count, button + 1)
elif button < 16: # Assume first 16 buttons exist
button_count = max(button_count, button + 1)
print("Detected axes: ", axis_count)
print("Detected buttons: ", button_count)
# Check if it's recognized as a gamepad vs joystick
var joy_name = Input.get_joy_name(device_id)
print("Device type: ", "Gamepad" if joy_name.length() > 0 else "Unknown")
# Test basic axis input
print("Current axis 0 value: ", Input.get_joy_axis(device_id, 0))
func _process(delta):
# Continuously monitor for controller changes
pass
func _input(event):
# Handle any controller input to get device info
if event is InputEventJoypadButton:
var device = event.device
print("Button press from device ", device)
print("Device name: ", Input.get_joy_name(device))
print("Device GUID: ", Input.get_joy_guid(device))
if event is InputEventJoypadMotion:
var device = event.device
print("Axis motion from device ", device, " axis: ", event.axis, " value: ", event.axis_value)
print("Device name: ", Input.get_joy_name(device))
print("Device GUID: ", Input.get_joy_guid(device))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment