`Input.get_connected_joypads()` does not work with HTML5 exporting

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


Here’s the code I’m trying to test this with:

var is_controller_connected: bool = Input.get_connected_joypads().size() > 0 print("Connected Inhale Controller: " + str(is_controller_connected))

When I run the game in-engine or exporting it to desktop the output will be:

Connected Inhale Controller: True

And of course, the output in the web export is:

Connected Inhale Controller: False

Let me know if there are any workarounds, fixes, or just solutions that could help me out.

:bust_in_silhouette: Reply From: Ninfur

I found this article, mentioning that

gamepads cannot be detected on the Web until a button is pressed on them

Could that be the issue? Are you running the check in some _ready or _init function?