Gamepad disconnection not detected on HTML5



  • Gamepad works great so far on HTML5, but one thing I noticed is that it doesn't detect when the gamepad is unplugged. FlxG.gamepads.numActiveGamepads is still "1" even after it's unplugged and there are no gamepads plugged in. The only way to let it know there's no gamepad is to restart the game. It's a shame because it would be nice to update the UI based on this. Is this a known bug, and is there any workarounds?


  • administrators

    This would most likely be an issue on Lime's / OpenFL's side (they're responsible for the gamepad events Flixel listens to).

    That being said, I'm seeing the same beavior on HTML5.



  • Thanks. Does any workaround that I can add in the game come to mind, like listening to those events from the game itself?


  • administrators

    No, if Flixel doesn't receive the event, OpenFL didn't fire one. Having an additional event listener of your own won't help with that.

    The event in question is DEVICE_REMOVED (see here: https://github.com/HaxeFlixel/flixel/blob/4.2.0/flixel/input/gamepad/FlxGamepadManager.hx#L316). You could check whether it's been fixed in newer OpenFL / Lime versions in a pure OpenFL project, and if not report it as an issue.


Log in to reply