Tuesday, August 27, 2019

Controller Usage in a Signed MacOS Game

"Why doesn't my controller work with my Mac game," you might ask.  You've been working on a Mac App Store project, following the very helpful Unity Apple Distribution Workflow.  It works in the Unity editor, but not in the exported build.  You tried both a wired controller and a bluetooth one, and neither of them gets detected.  You added prints that'll show you absolutely any input and nothing's happening at all.  So what's the deal?

As with many things Apple, this issue is an entitlement, and you can find some documentation of all possible MacOS entitlements here.

Specifically, once your app is signed it's trapped in a sandbox environment, and the only light filters through gaps provided by those entitlements.  In the case of a gamepad, we're talking either USB (wired) or Bluetooth (wireless).  This means you'll want to add this to your MacOS app's entitlement file:


Do that, rebuild, re-sign, and you should have working controllers in your build.

No comments:

Post a Comment