Create apps that allow players to interact with each other using GameKit.

GameKit Documentation

Post

Replies

Boosts

Views

Activity

GameKit Unity Sample works in Editor but not Player
I've build the Apple Unity plugins and added them to my Unity project. I've also loaded up the Apple.GameKit 1.0.4 GameKit Demo Scene. When I run this scene in the Unity editor, I get the prompt to select my Game Center account, and the username appears in the Editor Game window UI. From here, the other on-screen buttons work as well, I can pull up the Game Center Achievements window or the Realtime Matchmaking UI. If I build this project for macOS, and run the resulting app on the Mac, it isn't working. On the game UI, the "Local Player Name" text never updates to show the username of my GameCenter account. None of the on screen buttons work, nothing happens when clicked. If I build from unity for macOS with debug on, I can attach a debugger while running the app. If I do this, and add breakpoints, it seems that the application hits the first line from the Start() function of GameKitSample.cs : _localPlayer = await GKLocalPlayer.Authenticate(); But execution never seems to get past this point. It also doesn't seem to throw any exception. It just gets stuck here and I can't use any Game Kit features in the sample scene. What is missing? The same code seems to interact with Game Center just fine while running from the Unity Editor.
0
0
762
Jul ’23
Unity Apple plugin Issue
We are upgrading our ObjC-based iOS multiplayer game to Unity, so we plan to use the Unity Apple plugins. Specifically, we want to use Apple.Core and Apple.Gamekit packages. Cloned the project from https://github.com/apple/unityplugins Built the package using Unity 2020.3.33f1 In the Unity Editor, used Windows > Package Manager and added both packages from the tarball. No errors; all looks good. 5, Built & Run the project and installed the game on an iPhone 13 device. 6. Once the game starts, we see the following errors, and the game quits. Errors: '/private/preboot/Cryptexes/OS/usr/lib/swift/AppleCoreNative.framework/AppleCoreNative' (no such file), '/private/var/containers/Bundle/Application/0CF8E689-36C1-4AA6-9CF6-1E078EC1A3FB/Game.app/Frameworks/AppleCoreNative.framework/AppleCoreNative' (no such file), '/private/var/containers/Bundle/Application/0CF8E689-36C1-4AA6-9CF6-1E078EC1A3FB/Game.app/Frameworks/UnityFramework.framework/Frameworks/AppleCoreNative.framework/AppleCoreNative' (no such file), '/private/var/containers/Bundle/Application/0CF8E689-36C1-4AA6-9CF6-1E078EC1A3FB/Game.app/Frameworks/AppleCoreNative.framework/AppleCoreNative' (no such file), '/System/Library/Frameworks/AppleCoreNative.framework/AppleCoreNative' (no such file, not in dyld cache) Anyone, please help us to resolve the above issue?
1
0
952
Jul ’23
Buzzing when activate Voice Chat feature from GameKit
I got the sample project from Apple’s official documentation (https://developer.apple.com/documentation/gamekit/creating_real-time_games/). That sample project is a simple real-time game where two players are immediately aware of the actions each other takes. I figured out that one of the player's phone keeps buzzing when the voice chat is turned on. Suppose we have player A and player B. When the Voice Chat is activated, I noticed that player A can clearly hear player B's voice, but player B cannot hear anything except for their own voice, which can be heard by player A. Occasionally, this situation can switch. When a player is unable to hear anything, they only hear a constant beeping sound, even though their voice can still be heard by others. What happen? Anyone figured out how to solve this?
1
0
555
Jun ’23
Unity Game Crashes After GameCenter Login Attempt
We have Apple Unity Plugins imported to our project. We only include Apple.Core and Apple.GameKit. We have tried to import Empty 3D URP Sample Project and project worked on iOS but when we try to build for our project we got this error. On Empty Project, we just import the Apple Plugins, nothing about authentication or login to Apple Game Center. But in our main project, we login to Apple Game Center. We disabled the GameCenter Login code and game opens perfectly. No errors. The main problem is app crashes when we attempt to login to Apple Game Center. Do you have any suggestions for this? Unity: 2022.3.1f1 LTS (Current Latest LTS) OS: macOS Ventura 13.4 (Latest Stable) XCode: 14.3.1 (Latest Stable) Apple Plugins: Apple.Core 1.0.3 - Apple.GameKit 1.0.4 (Latest)
4
1
1.3k
Jun ’23
Game Center leaderboard privacy
I have implemented a standard GKLeaderboard in my app. The leaderboard includes the player's avatar, display name, and the score. I only use functionality provided by GameKit without any custom server functionality. I don't even have an own server. Still, my app got rejected with the following notice: We noticed that your app does not obtain the user's consent prior to uploading users' scores to a global leaderboard. To collect personal data with your app, you must make it clear to the user that their personal data will be uploaded to your server. What should I do here? Do I really have to obtain user's consent before uploading his score to Game Center?
2
0
835
May ’23
Ai controlled i-devices dev help
hey if i wanted to create an app that takes screenshots from an apple device (and any app within) to give context to an ai so the ai can then respond. Then the app parses the response then executes commands on behalf of the ai/user, how would I do so with the rule that "screenshots/captures are not allowed within other apps"? Want to stay within bounds of the rules in place. Possibilities: Ai assistant, Ai pals, passive automation
5
0
1.5k
May ’23
Transferring Apps with iCloud KVS
Hi All! I'm being asked to migrate an app which utilizes iCloud KVS (Key Value Storage). This ability is a new-ish feature, and the documentation about this is sparse [1]. Honestly, the entire documentation about the new iCloud transfer functionality seems to be missing. Same with Game Center / GameKit. While the docs say that it should work, I'd like to understand the process in more detail. Has anyone migrated an iCloud KVS app? What happens after the transfer goes through, but before the first release? Do I need to do anything special? I see that the Entitlements file has the TeamID in the Key Value store - is that fine? <key>com.apple.developer.ubiquity-kvstore-identifier</key> <string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string> Can someone please share their experience? Thank you! [1] https://developer.apple.com/help/app-store-connect/transfer-an-app/overview-of-app-transfer
2
0
1.1k
May ’23
Game Center issue on IOS 16.4
An issue appeared on IOS 16.4 when presenting GKMatchmakerViewController with the matchmakingMode set to inviteOnly. The view controller appears with the invite option as expected. But trying to tap it, the GKMatchmakerViewController disappears immediately. No problem on the previous IOS versions. It works also when matchmakingMode is not used at all.
7
2
1.6k
Mar ’23
GKLocalPlayer.FetchItems BAD ACCESS
We are using the Apple Unity plugin (Gamekit) to authorize players, using a Game Center account. To get player info we run a task from the plugin, var fetchItemsResponse = await GKLocalPlayer.Local.FetchItems(); But when this code run, there is an error in Xcode. The error is the following, Thread 1: EXC_BAD_ACCESS (code=257, address=0x2) MacOS 12.5 Monterey Unity 2021.3.4f1 XCode 14.2 AppleCore Unity Package - 1.0.2 AppleGameKit Unity Package - 1.0.3 Crashes when calling FetchItems in Unity Installed in iPhone XR (iOS 15.2.1)
3
0
1.3k
Feb ’23
SKAttributes do not work as expected with SKShapeNode instance
The documentation suggests that it should be possible to use a single shader with multiple instances of an SKNode, such that each instance will use the unique SKAttributes that are passed to it. Let's try that with an SKShapeNode. This is the fragment shader testFill.fsh, simply coloring based on the value for a_test: void main() {     gl_FragColor = vec4(vec3(a_test), 1.0); } And here we make two nodes `testNode0`, and `testNode1`, each using the same shader, but with a different value for `a_test`: class GameScene: SKScene {     override func didMove(to view: SKView) {         let testShader = shaderWithFilename( "testFill", fileExtension: "fsh", uniforms: [])         testShader.attributes = [             SKAttribute(name: "a_test", type: .float)         ] let testNode0 = SKShapeNode(rect: CGRect(x: 0.0, y: 0.0, width: 100.0, height: 100.0)) testNode0.fillShader = testShader testNode0.position = CGPoint(x: -100, y: 300) testNode0.setValue(SKAttributeValue(float: 0.2), forAttribute: "a_test") addChild(testNode0) let testNode1 = SKShapeNode(rect: CGRect(x: 0.0, y: 0.0, width: 100.0, height: 100.0)) testNode1.fillShader = testShader testNode1.position = CGPoint(x: 100, y: 300) testNode1.setValue(SKAttributeValue(float: 0.8), forAttribute: "a_test") addChild(testNode1) } } Here is the result: The squares are the same color, in particular the result of passing the second value 0.8 for a_test. Now, let's try the same thing with SKSpriteNode: class GameScene: SKScene {     override func didMove(to view: SKView) {         let testShader = shaderWithFilename( "testFill", fileExtension: "fsh", uniforms: [])         testShader.attributes = [             SKAttribute(name: "a_test", type: .float)         ] let testNode0 = SKSpriteNode() testNode0.size = CGSize(width: 100.0, height: 100.0) testNode0.shader = testShader testNode0.position = CGPoint(x: -100, y: 300) testNode0.setValue(SKAttributeValue(float: 0.2), forAttribute: "a_test") addChild(testNode0) let testNode1 = SKSpriteNode() testNode1.size = CGSize(width: 100.0, height: 100.0) testNode1.shader = testShader testNode1.position = CGPoint(x: 100, y: 300) testNode1.setValue(SKAttributeValue(float: 0.8), forAttribute: "a_test") addChild(testNode1) } } And it works! Why does the documentation not say that this is not possible with an SKSpriteNode? Why does an SKSpriteNode have a .setValue method if it does not function as expected? Is this a bug? Or something that is expected to be obvious? I am not sure, but I am sharing this in case somebody else ends up stuck on this issue as I was when otherwise trying to do something relatively straightforward. The solution (if your shape is a simple rect, as it is in my case) is to initialize an empty SKSpriteNode and size it accordingly, after which SKAttributes should work as expected. Apple, please either fix this, or update the documentation.
2
2
1.4k
Jan ’23
GKLocalPlayer.Local.FetchItems() Task Error on Unity
We are using apple unity plugin (gamekit) to authorized player using game center account. To get player the info we run a task from the plugin, var fetchItemsResponse = await GKLocalPlayer.Local.FetchItems(); But when this code run, there is an error on the xcode application on mac. The error is the following, Thread 1: EXC_BAD_ACCESS (code=257, address=0x2)
15
0
3.3k
Dec ’22
GameCenter causes hiccup when showing access point
Hello, In our Unity game, we've started experiencing application hiccup as a result of calling [[GKAccessPoint shared] setActive:YES]. The call itself does not take much time, but it seems to trigger something that causes a significant app stall causing running animations and transitions to feel laggy. This is new behaviour for us in iOS 16.1, as it did not cause any hiccups on 16.0 or earlier as far as we've noticed. We've tested the same build on 16.0 and 16.1, and it's working smooth on 16.0. The hiccup is present both when logged in and not logged into GameCenter. Did something change in 16.1 that requires us to use this API in a different way, or is it a (known) bug in iOS? My searches have not resulted in any similar reports. Best, -Trond
3
1
1.3k
Nov ’22
Is it possible to make Unity iOS App into iOS widget extension?
HELLO WORLD! I am currently developing an amazing Unity mini Game. The game development has come to the deploying stage. Using Unity allows me to deploy this game on MacOS, iOS, Android and Windows which is fantastic . However, I really need this game to have the iOS widget extension as a key feature on mobile. Just like the "Steve" dinosaur game which can be played in widget. I had seen a lot of tutorials and youtube videos but still cant find a solution which make Unity iOS app into a widget. If I really want to make widget Game on iOS, do I need to develop the whole game all over again in xcode or using GameKit? Really hoping there's a way to simply convert the Unity iOS app into a widget.
2
1
1.8k
Sep ’22
Game Center authentication workflow
Prior to iOS 14.5, I adopted the following workflow for my Game Center enabled game - At the launch, if there is no authenticated GKLocalPlayer, then store the viewController passed in the completion handler and display it later to the user (i.e. not immediately after the app completes launching). I am using the following code for the authentication process -         GKLocalPlayer.local.authenticateHandler = {viewController, error in             if (viewController != nil){ //store the viewController and present it at a later time             } else if (GKLocalPlayer.local.isAuthenticated) { //successfully authenticated             } else { // player could not be authenticated             } Since iOS 14.5 the callback to the authenticationHandler seems to have changed. The login prompt is displayed automatically after app launch, if there is no authenticated player. I checked - the completionHandler is not even being called in this case before the login prompt is presented. If there is already an authenticated player on the device, then the handler is called as expected. How can I prevent the login prompt from being displayed automatically by the system? Is there a new workflow for authenticating a player from iOS 14.5 onwards? thanks,
9
2
3.3k
Aug ’21