Repository navigation
Crash occurring when authenticating user for Game Center #60
Description
Describe the bug
I am using the latest version of the Game Center plugin for Unity and have noticed that my game will crash on launch when trying to authenticate.
I've tried this in an empty project with just the plugin and it still crashes with this exception.
GfxDevice: creating device client; threaded=1; jobified=0 Initializing Metal device caps: Apple A14 GPU Initialize engine version: 2022.3.62f2 (7670c08855a9) GameKitException: Code=-7 Domain=GKErrorDomain Description=The operation couldn’t be completed. (GKErrorDomain error -7.) (UnsupportedOperationForOSVersion) at Apple.GameKit.DefaultNSErrorHandler.ThrowNSError (System.IntPtr nsErrorPtr) [0x00000] in <00000000000000000000000000000000>:0 Rethrow as TypeInitializationException: The type initializer for 'Apple.GameKit.GKGameActivity' threw an exception.
And the area in the native code that is triggering the crash is this inside the GKLocalPlayer_SetAuthenticateHandler function
_onAuthenticate!(tid, _mostRecentAuthenticatePlayer!.passRetainedUnsafeMutablePointer());
I have also included this message because I thought it might help too
terminating due to uncaught exception of type Il2CppExceptionWrapper Could not import Swift modules for translation unit: failed to get module "GameKitWrapper" from AST context: error: 'GKErrorCodeExtension.h' file not found in file included from <module-includes>:1: error: could not build Objective-C module 'GameKitWrapper' warning: Ignoring missing VFS file: /Users/james/Library/Developer/Xcode/DerivedData/GameKitWrapper-dzawbtxqdxdviiakfxmfunexppqv/Build/Intermediates.noindex/GameKitWrapper.build/Release-iphoneos/GameKitWrapper-bc72bd3638f4d2956cac9b00e84c1a7d-VFS-iphoneos/all-product-headers.yaml This is the likely root cause for any subsequent compiler errors.warning: Ignoring missing VFS file: /Users/bill/Library/Developer/Xcode/DerivedData/GameKitWrapper-dzawbtxqdxdviiakfxmfunexppqv/Build/Intermediates.noindex/GameKitWrapper.build/Release-iphoneos/GameKitWrapper iOS.build/unextended-module-overlay.yaml This is the likely root cause for any subsequent compiler errors.warning: TypeSystemSwiftTypeRef::GetNumChildren: had to engage SwiftASTContext fallback for type $syyXCD
To Reproduce
Create XCode build and run on iOS device.
The error occurs when the GKLocalPlayer.Authenticate() function is called.
I have also included the script that we use for triggering the function (see attached GameCenterManager script).
We can update our Mac Mini to macOS 26 if need be but we would like to know ahead of time how likely it is that this would fix this issue as the min specs for this plugin state that it should support macOS 11.5 and iOS 15.6. We are not actually using GKGameActivity as you can see in the attached GameCenterManager script. We are only trying to add achievement support.
- Device: Mac Mini M2 2023, iPhone 12 mini
- OS: MacOS 15.7.2, iOS 18.6.2
- Version: Unity 2022.3.62f2
- Plugin Components: Core, GameKit
Activity
rdar://142306954 (SEED: Apple Unity Plug-Ins - Apple.CoreHaptics - Ha…
sebastienmalicet commentedon Nov 17, 2025
Hello,
"Apple.GameKit.GKGameActivity" feature required macOS 26.
FunkyFingerJames commentedon Nov 17, 2025
Ok, so if we update to macOS 26 then it should fix this issue on the iOS build? Why does the main repo page mention the minimum supported version of macOS is 11.5 if using GameKit will require updating to macOS 26? is it just out of date because of the recent commit that added support for 26?
We aren't actually using Game Activity, our code right now is only trying to authenticate at the moment.
KevinBjorv commentedon Nov 18, 2025
I'm getting this as well for all my testers that are not using IOS 26.
MattWallaceAzra commentedon Nov 18, 2025
Same here- ios 18 throws this exception, I assume docs need to be updated to reflect ios 26 requirement.
ryzngard commentedon Nov 18, 2025
Thanks for filing. Does this happen on the 3.0.2 release?
FunkyFingerJames commentedon Nov 19, 2025
This was happening with the GameKit 4.0.1 plugin and Core 3.2.0. It doesn't seem to happen on GameKit 3.0.0 but I haven't tried 3.0.2.
I did just discover today though that if you set the Managed Stripping Level in the Player settings to Minimal then it at least stops things from crashing (and I was able to get the authentication to work and log the user in).
MattWallaceAzra commentedon Nov 19, 2025
I downgraded our project to the 3.0.2 release and this no longer occurs.
boena commentedon Nov 20, 2025
I'm having the same issues here running Unity 6000.2.13f1 and Xcode 26.1.1. I've tried downgrading to 3.0.2 release but still face the same issues. Trying it on my iPhone with iOS 26.0.1 :(
boena commentedon Nov 20, 2025
I can also confirm what @FunkyFingerJames said that setting Managed Stripping Level to Minimal actually fixes the crash and my user is correctly signed in on both 3.0.2 and 4.0.1...
KevinBjorv commentedon Nov 22, 2025
Doesn't work for me unfortunently. I had to disable gamekit for all users not on IOS 26. That's the only solution I could find.
JVimes commentedon Dec 6, 2025
I get the UnsupportedOperationForOSVersion on the latest commit but not on the GameKit-3.0.2 commit. I built the plugins for iOS and see the exception running in Unity on Mac 15.7.2 (the latest for my machine).
ryzngard commentedon Dec 9, 2025
Any code stripping issues should be solved with #73
I'm looking into the GKGameActivity regression. That is identified correctly as a 26+ API but shouldn't be instantiated on older OS.
Fix apple#60
ryzngard commentedon Dec 9, 2025
Please try the changes in #74 and let me know if you are unblocked. Testing with the demo app on iOS 18 worked for me.
JVimes commentedon Dec 10, 2025
@ryzngard The branch from #74 works on my machine but builds GameKit 3.0.2 (not 4.0.1). Is that right?
ryzngard commentedon Dec 10, 2025
@JVimes that is unexpected. The package.json is showing 4.0.1.
JVimes commentedon Dec 10, 2025
@ryzngard My bad. 4.0.1 works on my machine.
Fix apple#60 (apple#74)
Fix apple#60 (apple#74)