Reputation: 3
Faced the problem that Google documented everything correctly, but it's not in vain, although it goes into the google play account, after which it thinks a little and sends it back to the game.
Perhaps something with the code was wrong.
private string leaderboard = "CgkI9pfnzM8FEAIQAQ";
void Start()
{
PlayGamesPlatform.Activate();
Social.localUser.Authenticate((bool success) => {
if(success)
{
Debug.Log("You have successefully loged in");
}
else
{
Debug.Log("Login failded");
}
});
}
LeaderboardOn()
{
((PlayGamesPlatform)Social.Active).ShowLeaderboardUI(leaderboard);
}
Hightscore()
{
if(score>highscore)
{
PlayerPrefs.SetInt("Highscore", score);
gameOverHighScoreText.GetComponent<Text>().text ="HIGHSCORE:"+score.ToString();
Social.ReportScore(score, leaderboard, (bool success) => {
if (success) print("Successefully added to Leaderboard");
});
}
}
Upvotes: 0
Views: 76
Reputation: 380
Hello Микита Рєпін
You activate PlayGamesPlatform by doing:
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.InitializeInstance(config);
PlayGamesPlatform.Activate();
Everything else seems okay, the only problem would be
LeaderboardOn()
should be void LeaderboardOn()
Highstcore()
should be void Highstcore()
Upvotes: 1