Search Unity

Unity - Google Play Services - Leaderboard UI crashing

Discussion in 'Scripting' started by vdubecky, Jul 14, 2018.

  1. vdubecky

    vdubecky

    Joined:
    Mar 4, 2016
    Posts:
    26
    Hello. I have a problem with Google Play Services - Leaderboard. Play Services works fine, but when a score is added to Leaderboard, Leaderboard UI is autmatic closed. This problem occurs both in the test and in the official versions of the game. Google Play Console will record the error, but without details.

    Code:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using GooglePlayGames;
    5. using GooglePlayGames.BasicApi;
    6.  
    7. public class LeaderboardScript : MonoBehaviour
    8. {
    9.    
    10.     void Start ()
    11.     {
    12.         PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
    13.         PlayGamesPlatform.InitializeInstance(config);
    14.  
    15.         PlayGamesPlatform.Activate();
    16.         SignIn();
    17.     }
    18.  
    19.     void SignIn()
    20.     {
    21.         Social.localUser.Authenticate(success => { });
    22.     }
    23.    
    24.  
    25.     public void LeaderboardButton()
    26.     {
    27.         if(Social.localUser.authenticated)
    28.         {
    29.             PlayGamesPlatform.Instance.ShowLeaderboardUI();
    30.         }
    31.         else
    32.         {
    33.             SignIn();
    34.         }
    35.     }
    36.  
    37.     public void AddScoreToLeaderboard(long score)
    38.     {
    39.         Social.ReportScore(score, GPGSIds.leaderboard_highscore, success => { });
    40.     }
    41. }
    42.  


    Thanks a lot
     
    Last edited: Jul 14, 2018
  2. vdubecky

    vdubecky

    Joined:
    Mar 4, 2016
    Posts:
    26
    Btw. I use Google Play Services 0.9.38. Versions larger than 0.9.38 dont work at all.