A
A
Artem Cheshihin2020-10-09 19:29:18
Google
Artem Cheshihin, 2020-10-09 19:29:18

Because of what, when opening the leaderboard in the unit, the google play account is logged out?

When I start the game, the play games account is authenticated normally, but as soon as I open the leaderboard, the account is logged out, what could be the reason for this? Maybe I didn't set up something correctly in the developer console?
Here is the code that initializes the services.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using UnityEngine.SocialPlatforms;

public class InitPlayServices : MonoBehaviour
{
    [SerializeField] Text status;
    void Start()
    {
        PlayGamesPlatform.Activate();
        if (!Social.localUser.authenticated) SignIn();
    }
    void Update()
    {
        if (!Social.localUser.authenticated) status.text = "Not authenticated";
        else status.text = "authenticated";
    }
    void SignIn()
    {
        Social.localUser.Authenticate((bool success) =>{});
    }
    public void GetBestRecord(int score)
    {
        Social.ReportScore(score, GPGSIds.leaderboard_score, (bool success) => { });
    }

    public void ShowBestRecord()
    {
        Social.ShowLeaderboardUI();
    }
    public void OnApplicationQuit()
    {
        PlayGamesPlatform.Instance.SignOut();
    }
}

The ShowBestRecord() method is called by pressing the button.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question