How to detect if a gamepad is or is not connected

I’m making menus for my game and was wondering if there is a way to tell if a gamepad is connected?

Hi @WilliamBoersma31,

Check the following browser API:

2 Likes

Hey @Leonidas I Know It’s Been A While Since I Last Responded To This Thread But When I Put In gamepad It’s Undefined And The Code Editor Asks Me If I Meant gamepad Which Is A Variable That Is Equal To this.app.gamepad I tried that but it made connected null what should I do from here

Update: There was a typo on the site the gamepad was supposed to have a uppercae G so I fixed that but gp.connected is still null

Here is a screen shot of the code
image

Hi @WilliamBoersma31,

Can you share a sample project to take a look?

Here Is My Code I Want this.Pad To Be True When There Is A Pad And False When There Is Not
https://playcanvas.com/editor/code/860529?tabs=62908420,62890522

right now it’s in slashes because I’m testing other things