• 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 squeegene · Oct 29, 2017 at 02:33 AM · iosapplehighscoressocialgamecenter

Does Social.LoadScores report ALL scores on GameCenter?

I have this piece of code tied to Apple's GameCenter:

 Social.LoadScores("HighScore", scores => {
             if (scores.Length > 0) {
                 Debug.Log("HIGHSCORE: " + int.Parse(scores[0].formattedValue));
             }
         });

I'm wondering why scores[] is a list of values. I can only test with one user so would scores[] be a list of ALL scores on GameCenter? I only need the localUser score!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by CanNguyen · Jul 21, 2018 at 12:24 AM

To retrieve local player score, you can get the scores from a specific leaderboard doing something like this:

     ILeaderboard leaderboard = Social.CreateLeaderboard();
     leaderboard.id = "HighScore";
     leaderboard.LoadScores(success =>
     {
         if (!success)
         {
             // Handle fail case: this is when your leaderboard doesn't load scores successfully
         }
         else
         {
             // you can retrieve the score of local user here
             long localUserScore = leaderboard.localUserScore.value;
         }
     });

To answer you question: Social.LoadScores does get a list of values into scores[], and I'm just finding out right now that it seems to only load top 10 scores (I literally just made multiple apple IDs to test).

I know this answer is late, but hopefully it can help whoever that stumbles across this post in the future.

Comment
Add comment · Show 2 · 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
avatar image pandolfini · Oct 28, 2020 at 01:16 PM 0
Share

This appears to still be correct as of 10/28/2020. I'm not sure why you are limited, as in Xcode Game Center allowed you to call more scores (I believe it was 100).

avatar image breban1 · Nov 26, 2020 at 04:31 PM 0
Share

This worked for me, although I added:

         leaderboard.timeScope = TimeScope.AllTime;

Before leaderboard.LoadScores to get all time. I was receiving 0 results when I didn't set that, so I'm assuming it was defaulting to something else (like today maybe?)

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

101 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it possible to send Game Center challenges to your friends using Unity's own Social API? 0 Answers

Game Center login issue 0 Answers

Social.ReportScore not doing anything on iPhone 1 Answer

Social.LoadAchievements sends Debug.Log messages 1 Answer

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