diff --git a/demos/misc/joysticks/joysticks.gd b/demos/misc/joysticks/joysticks.gd index f5bc1bddadf..f5466012e69 100644 --- a/demos/misc/joysticks/joysticks.gd +++ b/demos/misc/joysticks/joysticks.gd @@ -51,3 +51,12 @@ func _fixed_process(delta): func _ready(): set_fixed_process(true) + Input.connect("joy_connection_changed", self, "_on_joy_connection_changed") + +#Called whenever a joystick has been connected or disconnected. +func _on_joy_connection_changed(device_id, connected): + if device_id == cur_joy: + if connected: + get_node("joy_name").set_text(Input.get_joy_name(device_id)) + else: + get_node("joy_name").set_text("") diff --git a/demos/misc/joysticks/joysticks.scn b/demos/misc/joysticks/joysticks.scn index 3e0f326a0d4..7fc283ca692 100644 Binary files a/demos/misc/joysticks/joysticks.scn and b/demos/misc/joysticks/joysticks.scn differ