【发布时间】:2019-05-08 10:32:40
【问题描述】:
我正在设置使用 GooglePlayGames api 实现的排行榜服务。我的身份验证和显示排行榜有效,但我将分数发布到排行榜的脚本不起作用。我已经环顾了很长时间,似乎发布分数的语法总是相同的,我也有。
void Start()
{
AuthenticateUser();
}
void AuthenticateUser()
{
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
Social.localUser.Authenticate((bool success) =>
{
if (success == true)
{
Debug.Log("Logged in to Google play");
}
else
{
Debug.Log("There was an error login in to Google Play");
}
});
}
public static void PostToLeaderboard(long newScore)
{
Social.ReportScore(10, GPGSIds.leaderboard_highscore, (bool success) =>
{
if (success == true)
{
Debug.Log("Score were sucessfully added to leaderboard");
}
else
{
Debug.Log("Unable to post score to leaderboard");
}
});
}
这是我用于验证并将分数发布到排行榜的代码。我在代码 Social.ReportScore 函数调用中硬编码了 10。
关于为什么会这样的任何想法?排行榜 UI 显示,但没有得分。
【问题讨论】:
标签: unity3d google-play-services