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
0
Question by Shrikky23 · Dec 01, 2016 at 07:42 PM · delaysteamasyncleaderboardcallback

Steam Leaderboard delays

I have implemented steam leaderboard in my game. Here is the question. I have 50 levels. Correct me if my steps are wrong.

To get data :

  1. Find leaderboard by name (for each leaderboard) and get the SteamLeaderboard_t object (which is basically the leaderboard reference?)

  2. Then download leaderboard entries from that instance and store it as LeaderboardScoresDownloaded_t object

  3. Now I need to process the LeaderboardScoresDownloaded_t to get an array of LeaderboardEntry_t objects

  4. Process each LeaderboardEntry_t to get my Integer value (Score)

To upload data: 1. Find the leaderboard and get the isntance. 2. Upload the score to that particular instance.

The problem I have is, since these are all async callbacks, I do not always get the data at the right time when I try to download data. The achivements and stats are very straight forward though. Am I doing something wrong with the leaderboard? Why do I always have to find the leaderboard, download leaderboard entries, get the data from the entry and then pass the data to my UI?

Comment
Add comment · Show 2
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 CodeElemental · Dec 02, 2016 at 04:01 PM 0
Share

Did you try using Coroutines? You can add flags and checks for your specific scenario. It should eli$$anonymous$$ate race conditions.

avatar image Shrikky23 CodeElemental · Dec 05, 2016 at 01:09 AM 0
Share
     Hey, So I am trying to imagine how I can work with coroutines in this scenario.
     
     Lets say I have a function updategloballeaderboard();
     
     I want this function to get the current user's score in all the 50 leaderboards (1 leaderboard for each level).
     
     So I am imagining it will be like this 
     public int m_NumberOf$$anonymous$$erboardretrieved = 0;
     
     IEnumerator Updategloballeaderboard()
     {
        while(m_NumberOf$$anonymous$$erboardretrieved < 50)
        {
              while (!Found$$anonymous$$erboard )
              {
                  yield return null;
              }
     
              //Found leaderboard instance
              GetDownloaded$$anonymous$$erboardentry(m_leaderboardInstance)
     
             while(!Downloadedentries)
             {
               yield return null;
             }
     
             //Debug.Log(Downloaded $$anonymous$$erboard entry);
     
             GetUserScorefromDownloaded$$anonymous$$erboard();
     
           // I get the score and add it to the new total score
          // I increment the number of leaderboard processed by 1 and continue until 50
            m_NumberOf$$anonymous$$erboardretrieved ++;
            yield return null;
     
        }
     
     UploadScore(newScore);
     }

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DanBarreno · Dec 02, 2016 at 08:28 PM

    IEnumerator WaitingUpToDateToPrint()
     {
         while (!RankUpToDate )
         {
             yield return null;
         }

         foreach (SteamLeaders.UserInRank User in MortalRank.UserList)
         {
             print("Rank: " + User.UserName + " Name: " + User.UserName + " Score: " + User.UserScore);
         }
     }





Comment
Add comment · Show 1 · 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 Shrikky23 · Dec 05, 2016 at 01:13 AM 0
Share

Hey could you tell me what is S$$anonymous$$m$$anonymous$$ers and Userlist? If I am not wrong, you have to find the leaderboard, downloadleaderboard entries, retrieve data and then update the value before you upload right

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

56 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

Related Questions

Can't access to Time.time in callback method AsyncCallback 1 Answer

SceneManager.LoadScene used within promise (or async callback) does nothing 0 Answers

If i use async function, during the await Task.delay() , It starts another task 1 Answer

Unity TCP async functions 0 Answers

TCP Socket Async BeginSend never happens 3 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