Closed Tdflowers closed 5 years ago
I created a work around by checking after adding a controller to a local array if there are 4 controllers are connected and calling unpublishCentralService(). Then when a controller disconnects I republish.
I'm planning to add built-in support for controller limits, but for now, this is something you have to implement. Note, you might want to be sensitive to the difference between software and hardware controllers in your business logic. You can inspect the type of controller with controller.deviceInfo.controllerType
.
That's a cleaver work-around for how to avoid additional connections, BTW. It will not, of course, prevent hardware-based controllers from connecting because those don't go through the service - they directly connect via bluetooth.
Thanks for the reply, I will keep that in mind! Just got myself a hardware controller to do testing with.
Is it possible limit the number of connected devices? I am building a game and need to cap it at 4 players. Is there a way to refuse a connection?