Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Game Center capabilities not added to XCode

Discussion in 'iOS and tvOS' started by damelin, Apr 29, 2023.

  1. damelin

    damelin

    Joined:
    Jul 3, 2012
    Posts:
    64
    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.
     
  2. christopheAS

    christopheAS

    Joined:
    Jun 25, 2019
    Posts:
    16
    Same problem here: Unity 2021.3.22f and Xcode 14.3
     
    Last edited: May 12, 2023
  3. actislav

    actislav

    Joined:
    Mar 2, 2018
    Posts:
    8
    same for 2021.3.22f and for 2021.3.25f
     
  4. DeathPro

    DeathPro

    Joined:
    Jul 28, 2018
    Posts:
    69
    2022.3.0f1 LTS same thing happening :(((
     
  5. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    300
    Using Push Notification and it's not added automatically either.

    Unity 2021.3.15f, xCode 14.2
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,001
  7. thelosev

    thelosev

    Joined:
    Feb 13, 2014
    Posts:
    4
    Same for me. Has anyone filled a bug report?

    EDIT: Unity 2021.3.17, XCode 14.3.1
     
    Last edited: Jun 13, 2023
  8. DeathPro

    DeathPro

    Joined:
    Jul 28, 2018
    Posts:
    69
    2022.3.1f1 LTS same
     
  9. i9mobile

    i9mobile

    Joined:
    Aug 8, 2013
    Posts:
    54
  10. msnz

    msnz

    Joined:
    Nov 4, 2020
    Posts:
    31
    same here, using Unity 2020.3.40f1
     
  11. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
  12. TomTheMan59

    TomTheMan59

    Joined:
    Mar 8, 2021
    Posts:
    302
    The bug will NOT be fixed unless someone reports it. :(
     
  13. distriqt

    distriqt

    Joined:
    Aug 14, 2018
    Posts:
    1
    I've found enabling the entitlement manually seems to work, something like this in your OnPostprocessBuild :

    Code (CSharp):
    1.  
    2. var pathToBuiltProject = report.summary.outputPath;
    3. string entitlementsPath = pathToBuiltProject + "/Entitlements.entitlements";
    4. PlistDocument entitlements = new PlistDocument();
    5. entitlements.ReadFromString(File.ReadAllText(entitlementsPath));
    6. PlistElementDict entitlementsDict = entitlements.root;
    7. entitlementsDict.SetBoolean("com.apple.developer.game-center", true);
    8. File.WriteAllText(entitlementsPath, entitlements.WriteToString());
    9.  
     
    Khairon and ageana like this.
  14. ss-conor

    ss-conor

    Joined:
    Dec 7, 2020
    Posts:
    7
    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
     
    Last edited: Jul 18, 2023
    Tanek likes this.
  15. ss-conor

    ss-conor

    Joined:
    Dec 7, 2020
    Posts:
    7
    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.
     
  16. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
    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.
     
  17. Tanek

    Tanek

    Joined:
    Apr 19, 2016
    Posts:
    45
    MousePods likes this.
  18. Evaldas_Unity

    Evaldas_Unity

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    69
    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
     
    PandaArcade, Tanek, DeathPro and 2 others like this.
  19. smithmj5

    smithmj5

    Joined:
    May 24, 2013
    Posts:
    143
    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!
     
  20. josephmayoress

    josephmayoress

    Joined:
    Oct 17, 2023
    Posts:
    1
    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.
     
    Last edited: Oct 18, 2023
  21. smithmj5

    smithmj5

    Joined:
    May 24, 2013
    Posts:
    143
    Following up here: I only needed to add the entitlement. I do not call ProjectCapabilityManager.AddGameCenter and everything passed Apple's review and seems to be working properly.
     
  22. DwinTeimlon

    DwinTeimlon

    Joined:
    Feb 25, 2016
    Posts:
    296
    I have a similar problem. Since I upgraded the game to Unity Version 2021.3.31 the game won't build on Cloud Build anymore with the following error messages.

    "distribution profile" doesn't support the Game Center capability. (in target 'Unity-iPhone' from project 'Unity-iPhone')
    "distribution profile" doesn't include the com.apple.developer.game-center entitlement.
    Profile qualification is using entitlement definitions that may be out of date. Connect to network to update. (in target 'Unity-iPhone' from project 'Unity-iPhone') [error] [2023-10-25T17:21:18.685Z] - 7.3.24.2.7.4 - ERROR: xcode build failed

    The App has the Game Centre disabled in the App ID Configuration.



    It worked fine with 2020.3.45

    Any ideas?
     
    Last edited: Oct 27, 2023