-
Tap into Game Center: Leaderboards, Achievements, and Multiplayer
Level up your Game Center integration and enable players to compare scores on leaderboards, earn valuable achievements, and engage with other players. Organize special events like weekly championships, daily showdowns, or 1-hour competitions using recurring leaderboards. Create up to 100 unique achievements for your game. And we'll show you how to set up real-time or turn-based multiplayer matches for your Game Center players.
If you want to learn more about Game Center's interface, Dashboard, and player profiles, check out “Tap into Game Center: Dashboard, Access Point, and Profile.”
And for more about preparing your game's interface for these new capabilities, see “Design for Game Center.”Recursos
Vídeos relacionados
Tech Talks
WWDC22
- Plug-in and play: Add Apple frameworks to your Unity game projects
- Reach new players with Game Center dashboard
WWDC21
- Bring Recurring Leaderboards to your game
- What’s new in Game Center: Widgets, friends, and multiplayer improvements
WWDC20
-
Buscar neste vídeo...
-
-
4:05 - Submitting a score
// Use the class method to submit score to one or more leaderboards at once GKLeaderboard.submitScore(self.points, context: 0, player: GKLocalPlayer.local, leaderboardIDs: ["my.leaderboard.id"]) { error in } -
4:30 - Submitting a score - recurring leaderboard ID
// Use the class method to submit score to one or more leaderboards at once GKLeaderboard.submitScore(self.points, context: 0, player: GKLocalPlayer.local, leaderboardIDs: ["my.recurring.leaderboard.id"]) { error in } -
4:48 - Submitting to a specific occurrence of a recurring leaderboard
// Submitting to a specific occurrence of a recurring leaderboard GKLeaderboard.loadLeaderboards(IDs:["my.recurring.leaderboard.id"]) { (fetchedLBs, error) in if let lb = fetchedLBs?.first { lb.submitScore(self.points, context: 0, player: GKLocalPlayer.local) { error in } } } -
5:33 - Launching in-game UI
// Launching in-game UI // Display a list of leaderboards let vc = GKGameCenterViewController( state: .leaderboards) vc.gameCenterDelegate = self present(vc, animated: true, completion: nil) // Or directly display scores for a specific leaderboard let vc = GKGameCenterViewController( leaderboardID: "YOUR_ASC_LEADERBOARD_ID", playerScope: .global, timeScope: .allTime) vc.gameCenterDelegate = self present(vc, animated: true, completion: nil) -
7:14 - Accessing previous occurrence
// Accessing previous occurrence // Load current occurrence of a recurring leaderboard GKLeaderboard.loadLeaderboards(IDs:["my.recurring.leaderboard.id"]) { (fetchedLBs, error) in if let current = fetchedLBs?.first { // Load previous occurrence using the current occurrence current.loadPreviousOccurrence { (prevOccurrence, error) in // Do something with the previous occurrence } } } -
14:34 - Reporting achievement progress
if let achievement = GKAchievement(identifier: identifier) { achievement.percentComplete = percentComplete GKAchievement.report([achievement]) { error in if let error = error { print("Error in reporting achievements: \(error)") } } } -
16:05 - Displaying Game Center achievements
// Showing the Game Center achievements page let viewController = GKGameCenterViewController(state: .achievements) viewController.gameCenterDelegate = self present(viewController, animated: true) -
23:50 - Check if personalized communication is restricted
// Check if personalized communication is restricted if GKLocalPlayer.local.personalizedCommunicationRestricted { // Disable UI for Voice chat }
-