Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by pokeking · Apr 07, 2016 at 12:39 PM · words

iOS: Game Center show leaderboard with only my score ?

Hi, i'm making a leadearboard using with Game Center now, and i have 2 questions:

     static ILeaderboard m_Leaderboard;
     private int highScore = 1000;
     private string leaderboardName = "Test Ranking";
     private string leaderboardID = "55612367";
 //    private string achievementName = "70215624";
 
     // Use this for initialization
     void Start () {
         Social.localUser.Authenticate (ProcessAuthentication);
 
     }
     
     public void SendAndShow(){
         ReportScore(highScore, leaderboardID);
         DoLeaderboard();
     }
     ///////////////////////////////////////////////////
     // INITAL AUTHENTICATION (MUST BE DONE FIRST)
     ///////////////////////////////////////////////////
     
     // THIS FUNCTION GETS CALLED WHEN AUTHENTICATION COMPLETES
     // NOTE THAT IF THE OPERATION IS SUCCESSFUL Social.localUser WILL CONTAIN DATA FROM THE GAME CENTER SERVER
     void ProcessAuthentication (bool success) {
         if (success) {
             Debug.Log ("Authenticated, checking achievements");            
             Social.LoadScores(leaderboardName, scores => {
                 if (scores.Length > 0) {
                     // SHOW THE SCORES RECEIVED
                     Debug.Log ("Received " + scores.Length + " scores");
                     string myScores = "Leaderboard: \n";
                     foreach (IScore score in scores)
                         myScores += "\t" + score.userID + " " + score.formattedValue + " " + score.date + "\n";
                     Debug.Log (myScores);
                 }
                 else
                     Debug.Log ("No scores have been loaded.");
             });
         }
         else
             Debug.Log ("Failed to authenticate with Game Center.");
     }
     
     #region Game Center Integration
     ///////////////////////////////////////////////////
     // GAME CENTER LEADERBOARD INTEGRATION
     ///////////////////////////////////////////////////
     
     
     /// <summary>
     /// Reports the score to the leaderboards.
     /// </summary>
     /// <param name="score">Score.</param>
     /// <param name="leaderboardID">Leaderboard I.</param>
     void ReportScore (long score, string leaderboardID) {
         Debug.Log ("Reporting score " + score + " on leaderboard " + leaderboardID);
         Social.ReportScore (score, leaderboardID, success => {
             Debug.Log(success ? "Reported score to leaderboard successfully" : "Failed to report score");
         });
     }
     
     /// <summary>
     /// Get the leaderboard.
     /// </summary>
     void DoLeaderboard () {
         m_Leaderboard = Social.CreateLeaderboard();
         m_Leaderboard.id = leaderboardID;  // YOUR CUSTOM LEADERBOARD NAME
         m_Leaderboard.LoadScores(result => DidLoadLeaderboard(result));
     }
     
     /// <summary>
     /// RETURNS THE NUMBER OF LEADERBOARD SCORES THAT WERE RECEIVED BY THE APP
     /// </summary>
     /// <param name="result">If set to <c>true</c> result.</param>
     void DidLoadLeaderboard (bool result) {
         Debug.Log("Received " + m_Leaderboard.scores.Length + " scores");
         foreach (IScore score in m_Leaderboard.scores) {
             Debug.Log(score);
         }
         Social.ShowLeaderboardUI(); 
     }
     
     #endregion
 
  • i get the Leaderboard ID in iTune is 55612367 (and the name of Leaderboard ID is "com.test.ranking"), and when i build and run app, it show "No score" or "No leadboard". But when i replace ID "55612367" to "com.test.ranking", it show leadboard with my score. Please explain me about it ?

  • i use 2 account sandbox testers to test in 2 devices, but each device couldn't see each other's score. So how can i see other people's score in my leaderboard ?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Open scene by typing a word 1 Answer

How to cycle through random letters and make a word 1 Answer

Details of javascript words. 1 Answer

Word Brain Scramble word script ? 0 Answers

How do I split a word into individual characters and display them in a tile 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges