2025 Developer ToolsGraphics & Games
WWDC25 · 30 min · Developer Tools / Graphics & Games
Get started with Game Center
Explore the features of Game Center and learn how to get started. We’ll show you best practices for implementing achievements, challenges, leaderboards, and activities to maximize your game’s discoverability, attract new players, and increase engagement. To get the most out of this session, we also recommend watching “Engage players with the Apple Games app”.
Watch at developer.apple.com ↗Chapters
Code shown on screen · 7 snippets
Initialize GameKit
GKLocalPlayer.local.authenticateHandler = { _, error in
print("\(GKLocalPlayer.local.alias) is ready to play!")
} Initialize GameKit (Unity)
var player = await GKLocalPlayer.Authenticate();
Debug.Log($"{player.alias} is ready to play!"); Submit score to challenge
// Submit score
GKLeaderboard.submitScore(points,
context: 0,
player: GKLocalPlayer.local,
leaderboardIDs: ["thecoast.lb.capecod"]) Activity properties
// Activity properties
extension AppDelegate: GKLocalPlayerListener {
func player(_ player: GKPlayer, wantsToPlay activity: GKGameActivity) async -> Bool {
let activityId = activity.activityDefinition.identifier
if activityId == "thecoast.activity" {
let level = activity.properties["level"]
if level == "capecod" {
startCapeCod(activity)
}
}
return true
}
} Managing score submission with activity
// Managing score submission with activity
class GameplayManager {
let activity: GKGameActivity
let leaderboard: GKLeaderboard
init(activity: GKGameActivity, leaderboard: GKLeaderboard) {
self.activity = activity
self.leaderboard = leaderboard
activity.start()
}
func setScore(_ newScore: Int) {
activity.setScore(on: leaderboard, to: newScore)
}
deinit {
activity.end()
}
} Access the Party Code
extension AppDelegate: GKLocalPlayerListener {
func player(_ player: GKPlayer, wantsToPlay activity: GKGameActivity) async -> Bool {
let activityId = activity.activityDefinition.identifier
if activityId == "thecoast.multiplayer" {
startMultiplayer(partyCode: activity.partyCode)
}
return true
}
} Game Center Matchmaking
let match = try await activity.findMatch() Resources
Related sessions
-
21 min -
23 min -
27 min