Godot - Check if Controller connected or not

3.3k views Asked by At

I have a small tutorial in my game, which should tell the player how controlls work. There are not many, but it doesn't hurt to show them anyway.

So my game supports controller and keyboard + mouse. If the player has a controller plugged in, I want to show him the controller controls and if not, I want to show him the keyboard + mouse controls.

Now I have something like this already implemented which checks the MOUSE MODE. It works fine, but can only detect the controller if a button or a joystick was moved or pressed.

Is there anyway to check if a controller is connected?

input gdscript controller joystick control

1

There are 1 answers

0
puppetmaster On BEST ANSWER

You can use Input.get_connected_joysticks() and then look inside the array if there is a joystick. Also usefull for local multiplayer.

This event joy_connection_changed will also be usefull in some case.