Detecting Gamepad Type in embedded HTML5 game

Hi,
I’ve made my game update the in-game text displays for controls with the appropriate inputs when certain gamepads are used in controller port 1 (Xbox, PS4, and PS3 controllers), using the Gamepad Type condition (as well as the Gamepad Connected condition to display the default keyboard controls). However, I’ve noticed that in the browser-embedded version of my game, the text displays don’t update when my Xbox gamepad is used (I haven’t tested with Playstation gamepads). This error doesn’t seem to occur in the executable version and when previewing the game in GDevelop. Also the Gamepad Connected condition also seems to work fine in both the embedded and executable versions of the game (keyboard controls text appears in pause menu when no gamepad is used, as oppossed to no text when gamepad is used).

I use Firefox on Windows 10, and my game can be played here:
https://beth-a.itch.io/landshark

Thanks :slight_smile:

For @Bouh, I can confirm this.

The conditions around controller type work fine both local and online. The expression Gamepads::GamepadType(1) works fine on local preview and local games, but not on any hosted HTML5 game/web preview from the web demo of the engine.

This is because the hosted game are inside an iFrame, you have to be explicitly granted access by the hosting website via a Permissions Policy .

<iframe allow="gamepad" src="https://mygame.com/"> </iframe>

1 Like