Google Play服务不起作用。安装了最新版本的GPG插件。尝试了下面的版本,还有其他错误。在控制台中,我设置了Upload SHA1(用于测试)。发行版也有同样的错误。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;
public class PlayServices : MonoBehaviour
{
public static PlayServices instance;
const string leaderboardID = "*****";// leaderboard identificator
bool loginSucces;
private void Awake()
{
instance = this;
DontDestroyOnLoad(gameObject);
}
public void Start()
{
Debug.Log("google play services initialization");
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
LogIn();
}
public void LogIn()
{
Debug.Log("Try login");
Social.Active.localUser.Authenticate((bool success) =>
{
if (success)
{
Debug.Log($"Login is succes, account name{Social.localUser.userName}");
loginSucces = true;
}
else
{
...
}
});
}
}