- Home /
 
ShowLeaderboardUI not implemented???
Hi All, I have been looking at this for hours now and cant find a solution to it. I am trying to implement a simple leaderboard from Game Centre for my iOS game, I have it working it native iOS code (for a dummy app) so I know its configured right at Apples End but for some reason its not working in unity or on a device after building it. My Code is as follows, I have omitted irrelevant bits.
 import UnityEngine.SocialPlatforms.GameCenter;
 import UnityEngine.SocialPlatforms;
 //LeaderBoard Button
         if(GUI.Button(Rect(Screen.width/2 - bigBtnWidth/2, Screen.height - btnHeight*6,bigBtnWidth,btnHeight),"L E A D E R B O A R D", emptyGUI)){
             btnPressSound.Play();
             Debug.Log("LeaderBoard Button Pressed");
             
             
             Social.localUser.Authenticate (function (success) {
         if (success) {
             Debug.Log ("Authentication successful");
             noticeText = "Success";
             var userInfo : String = "Username: " + Social.localUser.userName + 
                 "\nUser ID: " + Social.localUser.id + 
                 "\nIsUnderage: " + Social.localUser.underage;
             Debug.Log (userInfo);
             Social.LoadScores("riftroller_leaderboard",Getscores);
             Social.ShowLeaderboardUI();
         }
         else{
             Debug.Log ("Authentication failed");
             noticeText = "Failed";
             }
             
     });
         }
 function ProcessAuthentication (success: boolean) {
     if (success) {
         Debug.Log ("Authenticated, getting leaderboard");
         noticeText = "Authenticated, Trying LeaderBoard";
         
         //LeaderBoard
            Social.LoadScores("riftroller_leaderboard",Getscores);
            //Social.ShowLeaderboardUI();
     
       }
     else{
         Debug.Log ("Failed to authenticate");
         noticeText = "Failed to authenticate";
         }
 }
 //Get HighScores
 function Getscores(scores: IScore[]){
     if (scores.Length > 0) {
             Debug.Log ("Got " + scores.Length + " scores");
             var myScores = "Leaderboard:\n";
             for(var score: IScore in scores){
                 myScores += "\t" + score.userID + " " + score.formattedValue + " " + score.date + "\n";
             Debug.Log (myScores);
             noticeText2 = myScores.ToString();
             }
         }else{
             Debug.Log ("No scores loaded");
             noticeText2 = "No Scores/Leaderboard";
             
     }
 
 }
 
               Any help for this would be much appreciated!
Thanks in advance.
Answer by sribas · Jul 03, 2017 at 10:09 AM
In case someone gets here because is getting the same error but when trying to use Play Games services (my case):
Add: PlayGamesPlatform.Activate ();
In your start or awake method.
Answer by fadsel · Dec 22, 2015 at 01:09 PM
This question appears to be old but for future references ,
You need to replace The default configuration with a custom configuration i.e game centre , what you did was .... you started authenticating the local user
Hope this helps someone :)
Cheers
If you found this helpful, Go play sticky bubble on Google Play
Your answer
 
             Follow this Question
Related Questions
Gamecenter leaderboards? 1 Answer
Can't call GameCenter in my Unity game for iOS 0 Answers
On iOS .. actually go to the GameCenter app? 1 Answer
Game Center login issue 0 Answers