Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

ShowLeaderboardUI not implemented???

$
0
0
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.

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>