Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Unity - Google Play Services - Leaderboard UI crashing

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

  1. PitrasCz

    PitrasCz

    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.         {
    28.             PlayGamesPlatform.Instance.ShowLeaderboardUI();
    29.         }
    30.         else
    31.         {
    32.             SignIn();
    33.         }
    34.     }
    35.  
    36.     public void AddScoreToLeaderboard(long score)
    37.     {
    38.         Social.ReportScore(score, GPGSIds.leaderboard_highscore, success => { });
    39.     }
    40. }
    41.  


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

    PitrasCz

    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.