Página 1 de 1

Problema com login no Google Play Services pela Unity

Enviado: Ter Jun 26, 2018 9:33 pm
por EGV
Eu queria adicionar o Google Play Services no meu jogo que fiz na Unity, eu já até publiquei ele na Play Store, o problema é que o meu script para login não está funcionando a tela de login do Google Play Games não aparece, se eu alguém poder me eu agradeço.
(https://play.google.com/store/apps/deta ... .Golkepper)

Código: Selecionar todos

using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine;
using UnityEngine.SocialPlatforms;


public class PlayGamesScript : MonoBehaviour {

    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()    
      .Build();

    private void Start()
    {
        SignIn();
    }
    void Activate()
    {
            PlayGamesPlatform.InitializeInstance(config);
            PlayGamesPlatform.DebugLogEnabled = true;
            PlayGamesPlatform.Activate();
    }
    public void SignIn()
    {
        if (PlayGamesPlatform.Instance.localUser.authenticated == false)
        {
            Activate();
            Social.localUser.Authenticate((bool success) =>
            {
                if (success)
                {
                    ((GooglePlayGames.PlayGamesPlatform)Social.Active).SetGravityForPopups(Gravity.BOTTOM);
                }
            });
        }
    }

    public void ActivateButton(GameObject button)
    {
        if (PlayGamesPlatform.Instance.localUser.authenticated == false)
            button.SetActive(false);
        else if (PlayGamesPlatform.Instance.localUser.authenticated)
            button.SetActive(true);
    }

    #region Achievements
    public static void UnlockAchievement(string id)
    {
        if (PlayGamesPlatform.Instance.localUser.authenticated)
            Social.ReportProgress(id, 100, success => { });
    }

    public static void IncrementAchievement(string id, int stepsToIncrement)
    {
        if (PlayGamesPlatform.Instance.localUser.authenticated)
            PlayGamesPlatform.Instance.IncrementAchievement(id, stepsToIncrement, success => { });
    }

    public static void ShowAchievementsUI()
    {
        if (PlayGamesPlatform.Instance.localUser.authenticated)
        {
            PlayGamesPlatform.Instance.ShowAchievementsUI();
        }
    }
    #endregion /Achievements

    #region Leaderboards
    public static void AddScoreToLeaderboard(string leaderboardId, long score)
    {
        if (PlayGamesPlatform.Instance.localUser.authenticated)
            Social.ReportScore(score, leaderboardId, success => { });
    }

    public static void ShowLeaderboardsUI()
    {
        if (PlayGamesPlatform.Instance.localUser.authenticated)
            Social.ShowLeaderboardUI();
    }
    #endregion /Leaderboards
}