【发布时间】:2019-06-28 01:33:34
【问题描述】:
我正在使用 google play 游戏服务插件在我的统一游戏中设置排行榜系统。
我想加载分数以便将它们集成到我的自定义 LeaderbordUI 中, 我遵循了文档并使用了 ILeaderboard.LoadScores 但它不起作用。
当我检查 logcat 时,我得到了这个:
02-04 11:03:56.580: W/Unity(18969): !!! [Play Games Plugin DLL] 02/04/19 11:03:56 +01:00 警告:从获取返回的错误:-108
我尝试使用“Social.LoadScores”和“PlayGamesPlatform.Instance.LoadScores”方法加载Score,但我收到了同样的警告。
PS:当我使用 Social.ShowLeaderboardUI() 时,它会显示排行榜。 但是当我使用 PlayGamesPlatform.Instance.ShowLeaderboardUI(LB_Stars.id) 显示特定的排行榜时,它给了我“嗯,玩游戏出了点问题”
public void LoadLeaderboard()
{
LB_Stars.LoadScores(ok =>
{
if (ok)
{
LoadUsersAndDisplay(LB_Stars);
}
else
{
Debug.Log("Error retrieving STARS leaderboard");
}
});
}
internal void LoadUsersAndDisplay(ILeaderboard lbStar)
{
Debug.Log("gonna load user and display them");
List<string> userIds = new List<string>();
foreach (IScore score in lbStar.scores)
{
userIds.Add(score.userID);
}
Social.LoadUsers(userIds.ToArray(), (users) =>
{
string status = "Leaderboard loading: " + lbStar.title + " count = " +
lbStar.scores.Length;
foreach (IScore score in lbStar.scores)
{
IUserProfile user = FindUser(users, score.userID);
if (user != null)
{
UserLeaderboardClone = Instantiate(UserLeaderboardPrefab);
UserLeaderboardClone.name = score.rank.ToString();
LeaderboardUserScript lbUser = UserLeaderboardClone.GetComponent<LeaderboardUserScript>();
lbUser.transform.SetParent(LBScrollview.content.transform, false);
FillUserInfo(lbUser, user, score);
}
}
});
}
【问题讨论】:
-
您能否显示比上述更详细的错误,以便社区检查?
-
我已经弄明白了,刚刚去掉了旧的google play游戏配置,重新开始,现在一切正常!
标签: c# unity3d google-play-games leaderboard