How can I detect controller when the game is launched?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bUguette

I know that I can use joypad_connection_changed but it only works after you plug the controller while game is already running. People often plug the controller before they launch the game so is there a way to check if controller is connected when launching the game? Maybe I should emit joypad_connection_changed manually but I don’t know how. Please help!

:bust_in_silhouette: Reply From: Wakatta
Input.get_connected_joypads()

Will return a list of connected joypad ID’s

Input.get_connected_joypads().size()

Will be zero if no devices are found

Thank you! That worked.

bUguette | 2021-08-22 08:45

Is there an equivalent in 3.5?

ANARCK3L | 2022-10-19 17:19