LinkGameCenter
Methods
public PlayerAccountOperation LinkGameCenter(GameCenterCredentials credentials, bool force = false, CancellationToken cancellationToken = default)
Adds Game Center authentication to the current player account.
Parameters
| Type | Name | Description |
|---|---|---|
| GameCenterCredentials | credentials | The credentials GameKit returned. |
| bool | force |
If the Game Center player is already linked to another player account, and a
If the Game Center player is already linked to another player account, and a |
| CancellationToken | cancellationToken | Can be used to cancel the operation. |
Returns
| Type | Description |
|---|---|
| PlayerAccountOperation | Result of the operation. |
Remarks
'Game Center Auth Enabled' must be ticked, and BundleId must be listed among the allowed bundle identifiers, in Project Settings on your Online Dashboard for this authentication method to be usable.
The credentials are the output of GameKit's fetchItems(forIdentityVerificationSignature:).
coherence never calls GameKit itself, so it cannot validate them, and two mistakes are
therefore only catchable on the calling side:
Pass GKLocalPlayer.teamPlayerID, not gamePlayerID. Apple's signature only attests
the teamPlayerID, and it is the identifier flavor the Game Center friends API returns, so
anything else is rejected as invalid credentials.
Only link when GKPlayer.scopedIDsArePersistent() is true. When it is
false — for guest players and some identity-less states — GameKit returns
session-scoped identifiers that change every session, so each link would attach a different,
throwaway identity. The signature still verifies, so neither coherence nor the backend can
detect this; the check on the calling side is the only guard.