Game Center capabilities not added to XCode

I’m using GameCenter (Social.localUser.Authenticate) for my iOS version. And Game Center is not present in XCode under Signing Capabilities. Is this by design?

I though Unity was adding it automatically upon detecting Game Center usage? I have “Automatically add capabilities” checked in Player Settings

I’m Unity 2021.3.21f1 with XCode 14.2

I can manually add the capabilities, which is adding com.apple.developer.game-center to the entitlements file.

Same problem here: Unity 2021.3.22f and Xcode 14.3

same for 2021.3.22f and for 2021.3.25f

2022.3.0f1 LTS same thing happening :(((

Using Push Notification and it’s not added automatically either.

Unity 2021.3.15f, xCode 14.2

Yep

Same for me. Has anyone filled a bug report?

EDIT: Unity 2021.3.17, XCode 14.3.1

2022.3.1f1 LTS same

same here 2022.3.4f1 LTS

I’ve also used with no success:

2 Likes

same here, using Unity 2020.3.40f1

Same here.
I just discovered that this ( Unity - Scripting API: iOS.Xcode.ProjectCapabilityManager.AddGameCenter ) is not working because we got the alert email from Apple (“Upcoming Game Center entitlement requirement”) and it’s stated that our games are not including it.

The bug will NOT be fixed unless someone reports it. :frowning:

I’ve found enabling the entitlement manually seems to work, something like this in your OnPostprocessBuild :

var pathToBuiltProject = report.summary.outputPath;
string entitlementsPath = pathToBuiltProject + "/Entitlements.entitlements";
PlistDocument entitlements = new PlistDocument();
entitlements.ReadFromString(File.ReadAllText(entitlementsPath));
PlistElementDict entitlementsDict = entitlements.root;
entitlementsDict.SetBoolean("com.apple.developer.game-center", true);
File.WriteAllText(entitlementsPath, entitlements.WriteToString());
3 Likes

Can confirm that ProjectCapabilityManager.AddGameCenter doesn’t appear to do anything. When creating a build and then checking XCode, the Game Center capability is still missing.

Strange, because it seems like ProjectCapabilityManager.AddPushNotifications and ProjectCapabilityManager.AddAppleSignIn both work…

Using Unity 2021.3.17f1

1 Like

This worked, thanks!

Still not able to add the Game Center capability, but seeing Apple only required the entitlement, I guess this will do for now.

Any news on this?
I’ve just submitted a bug report, I’ll share the link here as soon as it’s tracked on the Unity Bug tracker.

If you want to vote it, here’s the issue on the Issue Tracker: Unity Issue Tracker - Game Center entitlement is not added to Xcode when using “ProjectCapabilityManager.AddGameCenter”

1 Like

Hey, thank you for the report.
We’ve confirmed this and I am working on making ProjectCapabilityManager.AddGameCenter also add the required entitlement, not only capability

6 Likes

Do we need to add the entitlement, and also call ProjectCapabilityManager.AddGameCenter?

I can’t seem to find any documentation saying if it’s just one of those things, or both.

Apple’s email only mentioned needing the Game Center entitlement.

Thanks!

It’s a bit unusual that Game Center capabilities aren’t automatically added in Unity when you’re using Social.localUser.Authenticate. Unity generally does a good job of handling these things seamlessly.
Since you’ve got “Automatically add capabilities” checked in Player Settings, it should have added the necessary capabilities to your Xcode project. But if it hasn’t, manually adding the com.apple.developer.game-center capability is a good workaround.
But if you ever need to make quick decisions, you can use an online heads or tails coin. It’s a handy digital coin toss when you can’t find a physical one.