Is hotplugging possible in BGE?

I’ve just tried to unplug a gamepad while playing, and it caused an UnhandledExceptionFilter when bge.logic.joysticks is polled. This is pretty fair enough, but I wonder if there’s a way to handle this sort of behavior without a fatal failure.

Is there a proper way to handle users plugging and unplugging controllers during gameplay?

Because you get a UnhandledExceptionFilter. It sounds like unplugging the gamepad throws an exception you could handle.

To do that you’d need to add some python to that exception, https://wiki.python.org/moin/HandlingExceptions

That said, I don’t think there is a way to deal with that in in the Logic Editor, which would be very useful.

Hi,

with new SDL2 it is possible. I’m currently implementing in the BGE. Maybe, in the next weeks/month will be available. (see https://developer.blender.org/D1484)

I can catch that exception, yeah; but I can’t then do a sweep of the available ports to recheck for controllers~

Beautiful! I heard about SDL supporting that, a while ago, and was hoping for some progress on implementing it within the BGE. Thanks!