question

Matthew Clark avatar image
Matthew Clark asked

How to handle Legacy GameCenter IDs?

Unity 2019 changed Social.localPlayer.id to use the GameCenter Team ID (as per apple guidelines)

We're currently updating our build from Unity 2018.4 to 2019.4 and this gamecenter ID issue is going to cause issues for existing players who are using the Old GameCenter id.

Is it possible to connect a player with BOTH Game Center IDs?

My current plan is as follows:

Make a check PlayFab for the new GameCenter ID:

var request = new GetPlayFabIDsFromGameCenterIDsRequest()
{
   GameCenterIDs = new List<string>() { Social.localUser.id },
}; 

PlayFabClientAPI.GetPlayFabIDsFromGameCenterIDs(request, ...)

if no PlayFab id is returned, THEN try the legacy GC ID

string legacyId = ((UnityEngine.SocialPlatforms.Impl.UserProfile) UnityEngine.Social.localUser).legacyId;

var request = new GetPlayFabIDsFromGameCenterIDsRequest()
{
   GameCenterIDs = new List<string>() { legacyId },
}; 

PlayFabClientAPI.GetPlayFabIDsFromGameCenterIDs(request, ...)

If neither ID exists, then just login/create a user with Social.localUser.id otherwise use whichever id already has a PlayFab user.

Then, if we have logged in using the Legacy ID... then call PlayFabClientAPI.LinkGameCenterAccount with the new GameCenterID to link both accounts.

Will that work?

How has everyone managed Legacy gamecenter IDs in Unity/Playfab ?

unity3dAccount Management
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image
Seth Du answered

Players are required to log in successfully to access any PlayFab services, and in terms of your scenario, I suggest modify the login workflow and make sure the legacy game center will be migrate to the new Game Center ID.

You may first notify the players to log into your game (via push notification, email, or in-game news) so that the client will unlink the previous game center ID and link the new one. It is necessary because Link/Unlink API are only available in Client API sets, which means it should be done on the client. Meanwhile, when the login, the client will firstly try to use legacy id to login (with CreateAccount as false in the request). If it failed, the client will try to use the new Game Center ID to log in. When it still fails, the players may switch to other login methods part from Game Center or register a new account.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matthew Clark avatar image
Matthew Clark answered

Ok Obviously this idea doesn't work because GetPlayFabIDsFromGameCenterIDs throws an exception:

Caught exception in call to GetPlayFabIDsFromGameCenterIDs: PlayFab.PlayFabException: Must be logged in to call this method

How can I test if a user exists with a particular GameCenter ID without Logging in?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]