- Home /
 
Google Play Game Services,get player score...
Hi, I dont knw whether this question is asked before or not.I'm currentlty integrating the GooglePlayGameservices plugin provide by google - "https://github.com/playgameservices/play-games-plugin-for-unity".Everything is working fine.I just want to know whether is there any way to get the player score from the leaderboard.The code i tried for this is
         //If successfully synced to GooglePlay
         if(PlayGamesPlatform.Instance.IsAuthenticated())
         {
             Social.LoadScores(LeaderBoard_UID, scores => 
             {
                 if (scores.Length > 0) 
                 {
                     foreach (IScore score in scores)
                         if (score.userID == Social.localUser.id)
                     {
                         Debug.Log("Score from read function - "+score);
 
                     }
                 }
             });
              }
 
               This is not working.I alsow tried
PlayGamesPlatform.Instance.LoadScores ();
But if you take a look at the PlayGamesPlatform script in the plugin directory,the google guys have not implemented it yet.
Any luck accomplishing rather than writing my own plugin for play services using ADT ? Any help appreciated....
Answer by iwHiteRabbiT · Oct 08, 2015 at 08:52 PM
Maybe late but always usefull for anyone...
This has been (recently) implemented, and you have to make your query via Leaderboard.LoadScores like :
 var lb = Social.CreateLeaderboard();
 lb.id = "YourLeaderBoardID";
 lb.SetUserFilter(new string[] { "YourUserID" });
 
 // set lb.timeScope & lb.userScope if you want too
 
 lb.LoadScores(result =>
 {
     if (!result)
     {
         // Error
         return;
     }
                 
     // lb.scores[0].value may contains your Score
 });            
 
              Your answer