Answers for "check for controllers godot"

0

check for controllers godot

func _ready():
    Input.connect("joy_connection_changed", self, "_on_joy_connection_changed")
    #Checks what status is right now
    if Input.get_connected_joypads().size == 0:
      print("Keyboard")
   	else:
      #Gets controller type
      print(Input.get_joy_name(Input.get_connected_joypads()[0]))

func _on_joy_connection_changed(device_id, connected):
    if connected:
        print(Input.get_joy_name(device_id))
    else:
        print("Keyboard")
Posted by: Guest on August-04-2020

Python Answers by Framework

Browse Popular Code Answers by Language