我在游戏中使用Google服务排行榜。它不会在开始时进行身份验证,应通过单击按钮显示排行榜,但不显示任何内容。 我该怎么解决?
我的身份验证脚本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;
public class Auth : MonoBehaviour
{
public static PlayGamesPlatform platform;
private void Start() {
if (platform == null) {
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
platform = PlayGamesPlatform.Activate();
}
Social.Active.localUser.Authenticate(succes => {
if (succes) {
Debug.Log("ENTER GOOGLE SERVICES");
}
});
}
}
排行榜按钮脚本
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;
public class Lead : MonoBehaviour
{
private const string leaderboard = "Cg******";
public void OpenLead() {
Social.ReportScore(14, leaderboard, (bool succes) => {
if (succes) {
Debug.Log("SUCCESFUL ADDED");
}
});
Social.ShowLeaderboardUI();
}
}
我也在互联网上看到了很多这样的问题,但这并没有帮助。我使用最新的un-plays-plugin-for-unity,也尝试过
PlayGamesPlatform.Instance.ShowLeaderboardUI(leaderboard);
和
if ((((PlayGamesLocalUser) Social.localUser).Email != null) || (((PlayGamesLocalUser) Social.localUser).Email != ""))