是否有 Unity 2019- Social.localUser.id 获取旧版 gamecenterPlayerId?

Is there Unity 2019- Social.localUser.id get legacy gamecenterPlayerId?

我一直在将 unity 2017.4 更新到 2019.4,并将我的游戏构建到 ios。 问题是改变 Social.localuser.id 类型,从“G:xxxxx”开始到“T:xxxxxx”。 我搜索了一些研究,发现 Apple 将 player Id gameCenter id 更改为 TeamPlayerId,PlayerId。 我的游戏已上线,要迁移 Apple 的新 ID 类型,至少需要 3 个月使用 gamecenter ID 类型。

-- 1.如何获取旧版gamecenterid?

和 api 部分中的 Unity 2020.1.6 发行说明。 “iOS:添加:为旧版 Game Center 玩家 ID 添加了一个 public 访问器,让游戏更容易迁移到 iOS 12.4 中的新 ID 类型”。

-- 2.但是我不知道如何获取旧版Game Center玩家ID?

-- 3. 有计划更新 unity 2019 lts 版本以获得传统类型的 Game Center Player Id 吗?

感谢您的阅读。

据我所知,Apple 不再允许任何旧的 API 调用。它们允许向后兼容商店中已有的应用程序,但任何新应用程序都必须使用当前框架。

~皮诺

我不能 100% 确定我是否正确阅读了这个问题,而且我知道这是一个老问题,但我在从 Unity 2018 LTS 迁移到 Unity 2019 LTS 时遇到了类似的问题,我相信接受的答案不包括我用来使这一切正常工作的选项。

要获取新的 GameCenter ID,您需要在 Unity 2019 LTS 中使用此调用

var gameCenterTeamId = Social.Active.localUser;

要获取旧版 GameCenter ID(之前可以通过上述调用在 Unity 2017/2018 LTS 中访问),您需要使用此调用

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

第二次调用的文档完全 here. The Unity docs recommend you only do it to migrate users over to the new GameCenter Team ID, as iOS has deprecated that old GameCenter player id