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

GameCenter Leaderboard Reporting Scores

$
0
0
Right, so this is driving me insane. I have implemented a GameCenter leaderboard in my game to view high scores. GameCenter authentication works and I can view the leaderboard, but no scores are showing up despite having reported a score. **My main code for the leaderboard:** public class SocialPlatformController : MonoBehaviour { public static SocialPlatformController controller; private static string LEADERBOARD_ID = "MyHighScoreLeaderboard"; public bool m_loginSuccessful; void Awake() { if (controller == null) { DontDestroyOnLoad(gameObject); controller = this; } else if (controller != this) { Destroy(gameObject); } } // Use this for initialization void Start () { Social.localUser.Authenticate(ProcessAuthentication); } public void ProcessAuthentication (bool success) { if (success) { Debug.Log("Authenticated user."); } else { Debug.Log("Failed to authenticate user."); } m_loginSuccessful = success; } public void DisplayLeaderboard() { //Social.ShowLeaderboardUI(); GameCenterPlatform.ShowLeaderboardUI(LEADERBOARD_ID, TimeScope.AllTime); } public void SetHighScore(int score) { long highScore = (long)score; if (m_loginSuccessful) { Social.ReportScore(highScore, LEADERBOARD_ID, success => { Debug.Log(success ? "Reported score successfully." : "Failed to report score."); }); } else { Social.localUser.Authenticate(ProcessAuthentication); if (m_loginSuccessful) { Social.ReportScore(highScore, LEADERBOARD_ID, success => { Debug.Log(success ? "Reported score successfully." : "Failed to report score."); }); } } } } **When I report a score, I do something like this:** //Yes, my score has to be an object for various reasons object highScore = 50.015f; //Convert the object into an int, to simplify the score int convertedHighScore = (int)(float)highScore; //Report the score SocialPlatformController.controller.SetHighScore(convertedHighScore); The leaderboard is live and attached to my app, which also just went live. Please help!

Viewing all articles
Browse latest Browse all 4709

Trending Articles



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