-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a method to know if a joystick is plugged #5465
Comments
Good catch. |
I think i'd be happy with any one of these two methods, so I guess that having both would be a bliss ^^ |
On a second thought, I think the first one will be enough. if device_id in Input.get_connected_joysticks(): |
I used this method to find out if a joystick is plugged. Without joystick Input.get_joy_name() returns an empty string which can be used in as false. |
@kakoeimon : oh thanks for the idea. I did not think of it ! |
Operating system or device - Godot version:
Official 2.0.3stable and custom 2.1alpha
Issue description (what happened, and what was expected):
I've found no method to know if a joystick is already plugged.
The workarounds are :
Input.is_joy_known()
; but, if I understood correctly, it will only return true if the joystick has a mapping.I would like to know in advance how many joysticks are already connected without asking to the players to press buttons.
Steps to reproduce:
Link to minimal example project (optional but very welcome):
The text was updated successfully, but these errors were encountered: