Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by $$anonymous$$ · Nov 13, 2012 at 03:59 PM · c#socialgamecenterleaderboards

GameCenterPlatform - Load leaderboards with custom parameters

Hello everyone :)

I'm implementing GameCenter using Unity's GameCenterPlatform.

I am aware of the default implementation using LoadScores, like the documentation suggests:

 Social.LoadScores("Leaderboard01", scores => {
     if (scores.Length > 0) {
         Debug.Log ("Got " + 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 loaded");
 });

The documentation states:

This uses default leaderboard parameters.

Unfortunately I am not aware what these "default parameters" are, I'm not sure what scores is returned from the leaderboard. Is there anyone who is aware of a way to retrieve scores based on your own custom search query?

Thank you for your time :)

Comment
Add comment · Show 1
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
avatar image solid_ · Jul 31, 2016 at 12:18 PM 0
Share

Debug in Xcode says.... LoadScores retrieve only 10 scores from rank 1 to 10 using default parameters

Use m_$$anonymous$$erboard.range = new Range (m_$$anonymous$$erboard.localUserScore.rank, range);

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by abeldantas · Aug 18, 2017 at 08:50 PM

In Unity 5.6 you can do stuff like:

 void ShowScoresForToday()
 {
     // OutputField is a Unity text element I'm using to debug this on the device
     OutputField.text = "";
 
     var leaderboardID = "leaderboard";
     var log = string.Format( "Showing top score for leaderboard with id: '{0}'", leaderboardID );
     Debug.Log( log );
     OutputField.text = log;
 
     var leaderboard = Social.CreateLeaderboard();
     leaderboard.id = leaderboardID;
     leaderboard.timeScope = TimeScope.Today;
     leaderboard.LoadScores( success =>
     {
         var scores = leaderboard.scores;
         if ( scores.Length > 0 )
         {
             foreach ( var score in scores )
             {
                 var logLine = string.Format( "User with id '{0}' has a score of {1}, rank is {2}",
                     score.userID, score.value, score.rank );
                 OutputField.text += "\n" + logLine;
             }
         }
         else
         {
             Debug.LogError( "No scores registered" );
         }
     } );
 }


You have to initialize the Leaderboard object before querying, with the Social.CreateLeaderboard()

The filters are, hm, limited - https://docs.unity3d.com/ScriptReference/SocialPlatforms.ILeaderboard.html

Comment
Add comment · Share
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

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

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Did Social.LoadUsers() stop working? 3 Answers

Social Api causing crashes 2 Answers

How can I show a specific leaderboard in iOS GameCenter? 2 Answers

Game Center login issue 0 Answers

When will Social.ReportScore() fail? 0 Answers


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