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

Posts under GameKit tag

81 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

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
Oct ’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
Oct ’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
840
Oct ’23
Game Center and App transfer
We transferred application, using guide there: https://developer.apple.com/help/app-store-connect/transfer-an-app/overview-of-app-transfer/ We use Game Center to identify users via playerid https://developer.apple.com/documentation/gamekit/gkplayer/1521127-playerid After transferring application playerid for our current users is changed, and so users are unable to login How can we restore playerid for our users? For "Sign in with Apple" there are migration process, so there are no issues, is there something like that for Game Center?
1
1
513
Oct ’23
Game Center Login Notification Displayed at Top in the App
In the app, when logged into Game Center and moving the app to the background and then returning to the foreground, the Game Center login message is displayed at the top every time. Before iOS 17, this message was only shown at the initial login and app launch. However, from iOS 17, this message is displayed during the transition from background to foreground. Is this an intended feature or a bug?
0
0
420
Sep ’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
560
Sep ’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
Sep ’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.7k
Sep ’23
Headless Game Center Testing
Hello, We have an API that wraps around Game Center API and we would like to have automated tests for our API. The test would need to run in a remote data center, so there is no way to perform manual test steps. Ideally, we would want to simulate sign in and sign out, test achievements and game saves without the need for any manual input. Running in the simulator should be enough for our use case, though we could also use real devices if necessary. Is there any way to accomplish that?
0
0
427
Sep ’23
How to manage GKGameCenterViewController with app lifecycle?
What should an app do with an instance of GKGameCenterViewController when the app transitions to the background? Currently, my app just leaves it in place, displayed on top in full screen. Most of the time when my app resumes to the foreground, the GKGameCenterViewController is still displayed and is functional. However, sometimes when the app resumes, the GKGameCenterViewController's view has vanished and, additionally, my app doesn't receive a GK authentication event, so effectively it is "hung". This seems to happen most often when the app has been in the background a while, such as overnight. The app is still in memory, however, not starting cold. I would like to leave the GKGameCenterViewController/view in place when the app is backgrounded since the player may return to the game quickly and be right back where they left off. And most of the time that works. However, I need to solve the problem for the times it doesn't as I described above. Is there any guidance on what to do with a GKGameCenterViewController (or any GK controller for that matter) when an app goes into the background?
0
0
438
Aug ’23
XCode build fail when add Apple.GameKit plugin for Unity: Undefined symbol
I have a Unity project, after setting up Apple.Gamekit plugin, it show up some error when build with XCode: ld: warning: arm64 function not 4-byte aligned: _unwind_tester from /Users/mac/Documents/Bonex/BoneX_demo1/iOSBuild_demo2/Libraries/libiPhone-lib.a(unwind_test_arm64.o) Undefined symbols for architecture arm64: "_GKLocalPlayer_Authenticate", referenced from: _GKLocalPlayer_GKLocalPlayer_Authenticate_mA13EED25E9E6BC8EAA0DE8E36D389AC904B41435 in Apple.GameKit.o (maybe you meant: _GKLocalPlayer_GKLocalPlayer_Authenticate_mA13EED25E9E6BC8EAA0DE8E36D389AC904B41435, _GKLocalPlayer_Authenticate_m3BBD62A177560D3F93691F97581B484A6EBA0836 ) "_GKLocalPlayer_GetIsMultiplayerGamingRestricted", referenced from: _GKLocalPlayer_GKLocalPlayer_GetIsMultiplayerGamingRestricted_m347F15CBE262C877190B5C7F4B55AFAD595705D5 in Apple.GameKit.o (maybe you meant: _GKLocalPlayer_GKLocalPlayer_GetIsMultiplayerGamingRestricted_m347F15CBE262C877190B5C7F4B55AFAD595705D5) "_GKLocalPlayer_GetIsPersonalizedCommunicationRestricted", referenced from: _GKLocalPlayer_GKLocalPlayer_GetIsPersonalizedCommunicationRestricted_mB1E3D7AE957AAA19E6ABBDCDEAD9821B09EB1DC1 in Apple.GameKit.o (maybe you meant: _GKLocalPlayer_GKLocalPlayer_GetIsPersonalizedCommunicationRestricted_mB1E3D7AE957AAA19E6ABBDCDEAD9821B09EB1DC1) "_GKLocalPlayer_GetIsUnderage", referenced from: _GKLocalPlayer_GKLocalPlayer_GetIsUnderage_mF266E6F8AA10922F3B02ED3A877D3C403EA46045 in Apple.GameKit.o (maybe you meant: _GKLocalPlayer_GKLocalPlayer_GetIsUnderage_mF266E6F8AA10922F3B02ED3A877D3C403EA46045) "_NSError_Free", referenced from: _NSError_NSError_Free_m0AFB1ED4BF090D6E5276479A1F53680D4FD47A4A in Apple.Core.o (maybe you meant: _NSError_NSError_Free_m0AFB1ED4BF090D6E5276479A1F53680D4FD47A4A) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) The plugin I added, which is provided by Apple: https://github.com/apple/unityplugins My : build appunityplugin used 2020.3.33f1 XCode to version 14.3.1 Please help! Thank you!!!
3
0
2.0k
Aug ’23
Reset GameCenter scores
Is it possible to remove/reset GmeCenter scores for my game app? I'd like to remove all scores so new users can start to compete. Is this possible? The games are educationally based and I'fd like to reset score for a new class.
0
0
438
Aug ’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
Aug ’23
Not imported Metal but getting these errors!
Device : iPhone 13 Pro, iOS 17 Beta 5. Xcode : Both 14.3.1 and 15 Beta 5 My app is crashing for no reason after a touch gesture on my device, but it's working fine on a simulator. I have used GameKit but not imported Metal or SpriteKit. I'm getting these errors. CleverJacks[791:45451] Metal API Validation Enabled -[MTLDebugRenderCommandEncoder setRenderPipelineState:]:1615: failed assertion `Set Render Pipeline State Validation For color attachment 2, the render pipeline's pixelFormat (MTLPixelFormatRGBA16Float) does not match the framebuffer's pixelFormat (MTLPixelFormatR16Float). the pipelineState's per sample imageBlock usage(14) is greater than the encoder's perSample imageBlock usage(8)
1
1
622
Aug ’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
964
Aug ’23
Is GKLocalPlayer's gamePlayerID different from the gamePlayerID other players in the GKMatch can access/see?
I'm trying to make a real-time peer-to-peer multiplayer game with GameKit/Game Center. I'm trying to store a dictionary of player IDs and scores ([String:Int]) to keep track of and share player scores during a game. Essentially, I want to be able to increment the score of a player locally, then send the updated scores dictionary to all the other players. However, the GKLocalPlayer.local.gamePlayerID seems to be in a completely different format than any other connected GKPlayer, so when I try to access the GKMatch.players with the gamePlayerID, it isn't found (and yes, I'm aware that GKMatch.players doesn't contain the local player). The GKPlayer has an 18-digit long integer, whereas the GKLocalPlayer has A:_ and then a long hexadecimal number (I think it's 37 digits in decimal). Can someone explain this difference or point to some resources that explain how I can implement this functionality correctly? Here's a simplified example of what I'm doing: var scores: [String:Int] // dictionary of [gamePlayerID:Score] scores[myMatch.players.first.gamePlayerID] = 3 scores[GKLocalPlayer.local.gamePlayerID] = 5 sendScores(scores) // sends data to all players using myMatch.sendData() /* When the receiving players decode and try to access scores[gamePlayerIDOfSendingPlayer], it isn't found because it's different from that player's gamePlayerID in the receiving player's GKMatch.players array */
1
1
437
Aug ’23
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.4k
Jul ’23