Platforms to show: All Mac Windows Linux Cross-Platform

Back to GKScoreMBS class.

GKScoreMBS.category as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The leaderboard that this score belongs to.

The category string must match an identifier you created when you defined your leaderboards on iTunes Connect.
(Read and Write computed property)

GKScoreMBS.Constructor(category as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Initializes a score object.

Category: A category identifier for a specific leaderboard you've configured on iTunes Connect. Must not be "".

Your game explicitly allocates and initializes a score object when it needs to report a new score to Game Center.

GKScoreMBS.context as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
property GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
An integer value used by your game.

The context property allows your game to associate an arbitrary 64-bit unsigned integer value with the score data reported to Game Center. You decide how this integer value is interpreted by your game. For example, your game might use the context property to store flags that provide game-specific details about a player's score, or it might use the context as a key to some other data stored on the device or on your own server. In either case, your game typically uses this information when it displays a custom leaderboard to the player.
(Read and Write computed property)

GKScoreMBS.date as date

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The date and time when the score was earned. (read-only)

When you initialize the new score object, the date property is automatically set to the current date and time.

GKScoreMBS.formattedValue as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the player's score as a localized string. (read-only)

This property is invalid on a newly initialized score object. On a score returned from Game Kit, it contains a formatted string based on the player's score. You control the formatting of this string by configuring your leaderboards on iTunes Connect.

Never convert the value property into a string; always configure your leaderboard and call this method to receive the formatted string.

GKScoreMBS.issueChallengeToPlayers(playerIDs() as string, message as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Use this method to issue GKScoreChallenges and GKAchievementChallenges to an array of playerIDs.

Players may not issue challenges to themselves nor to non-friends. Please see the GameKit reference documentation for further details on these methods.
Available on Mac OS X 10.8.2 and newer.

GKScoreMBS.playerID as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The player identifier for the player that earned the score. (read-only)

When you initialize a new score object, the playerID property is set to the identifier for the local player. If you read the property on a score object retrieved from Game Center, playerID identifies the player who recorded that score.

GKScoreMBS.rank as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The position of the score in the results of a leaderboard search. (read-only)

The value of this property is undefined on a newly initialized GKScore object. It is only valid on score objects received from Game Center. The rank property represents the position of the score in the returned results, with 1 being the best score, 2 being the second best, and so on.

GKScoreMBS.reportScore(tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Reports a score to Game Center.

The value property must be set before calling this method.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls GameKitMBS.reportScoreCompleted.

If the score object successfully reports progress to Game Center, your game may release it. Otherwise, your game should inspect the error. If the error is a network error and your game is running on iOS 4.3 or earlier, your game should periodically attempt to report the progress until the score is successfully reported. On iOS 5.0 and later and on OS X, the background reporting task automatically handles network errors on your game's behalf.

GKScoreMBS.shouldSetDefaultLeaderboard as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
A Boolean value that indicates whether this score should also update the default leaderboard.

If the value of this property is true, when the score is reported to Game Center, Game Center also updates the default leaderboard to match the value stored in the category property of the score object. This matches the behavior of the GKLeaderboardMBS class's setDefaultLeaderboard class method. If the value of this property is true, the default leaderboard is not changed by reporting the score. The default value of this property is false.
(Read and Write computed property)

GKScoreMBS.value as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
property GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The score earned by the player.

You can use any algorithm you want to to calculate scores in your game. The value provided by a score object must match the formatting string configured for your leaderboard on iTunes Connect. Your game must set the value property before reporting a score, otherwise an error is returned.
(Read and Write computed property)

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...