gpt4 book ai didi

android - 使用 Google Play 游戏插件的 Social.ReportProgress 方法总是返回 false

转载 作者:行者123 更新时间:2023-11-29 20:55:41 27 4
gpt4 key购买 nike

我遇到了 Google 为 Unity3D 编辑器提供的 Google Play 游戏插件的问题。我刚刚将该插件包含在我的统一项目中,当我将应用程序构建到我的 Android 设备上时,我可以使用我的 Google 帐户登录 Google Play 游戏。但是,我的成就从未在线修改过,因为 Social.ReportProgress 方法的回调始终返回“false”。 ( bool 成功)

// unlock achievement (achievement ID "Cfjewijawiu_QA")
Social.ReportProgress("Cfjewijawiu_QA", 100.0f, (bool success) => {
// handle success or failure
});

我已经检查过我为我的成就使用了正确的 ID。我的代码和谷歌在github上提供的这段官方代码的区别是百分比。例如,我的应用程序可以将“33.3333”作为百分比。当我尝试将相同的百分比放在方法 (100.0f) 上时,bool success 也是错误的。怎么了 ?

最佳答案

好的,我找到问题了。

在插件的github仓库上,我拿了这段代码来初始化GPG:

PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
// enables saving game progress.
.EnableSavedGames()
// registers a callback to handle game invitations received while the game is not running.
.WithInvitationDelegate(this.Debug)
// registers a callback for turn based match notifications received while the
// game is not running.
.WithMatchDelegate(this.Debug)
.Build();

PlayGamesPlatform.InitializeInstance(config);

当我在 Unity 的初始化类中删除此部分时,成就报告效果很好。我认为这些行中存在一些问题,但我不知道在哪里。

此外,我了解到我无法设置像 33.333 这样的自定义百分比值。锁定成就的值必须为 0.0f,解锁成就的值必须为 100.0f。如果输入大于 0.0f 的值,则该值将自动视为 100.0f。如果您想对成就进行自定义步骤,则必须使用 Google Play 控制台上的增量成就。

关于android - 使用 Google Play 游戏插件的 Social.ReportProgress 方法总是返回 false,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27854575/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com