LoadScoreByUser pro...
Clear all

LoadScoreByUser problem

4 Posts
2 Users
Posts: 6
Active Member
Topic starter

Hello. I must apologice if this question is a bit stupid but i have been fighting a lot and i´m really overflowed.

I am trying to read the max score from the leaderboard "123" and for the user already signed in.

As I read in the manual, the syntax must be: 

// Load the best score of leaderboard ID ’123’ for the User object with 1 results per page (to be
attendible ’page’, the limit must be the same as used with LoadScores)
Leaderboard.LoadScoresByUser("123", CombuManager.localUser, eLeaderboardInterval.Total, 1, (Score score,
int page, string error) => {
if (score != null)
Debug.Log("Success: " + score.value + " at page " + page);
Debug.Log("Failed: " + error);

As LoadScoresByUser is deprecated i changed it to LoadScoreByUser, but i have always the same error with both of them:

No overload for method 'LoadScoreByUser' takes 5 arguments.

When I search in the API documentation, it says:

virtual void Combu.CombuPlatform.LoadScoresByUser ( string  leaderboardId,
    User  user,
    eLeaderboardInterval  interval,
    int  limit,
    System.Action< Score, int, string >  callback 

But the example is:

CombuManager.platform.LoadScores ("1234", CombuManager.localUser, eLeaderboardInterval.Week, 10, (Score score, int page, string error) => {
Debug.Log("Score: " + score.rank);
So I decided to change to LoadScores, but then CombuManager.localUser  says:
Argument 2 cannot convert from Combu.User to UnityEngine.SocialPlatforms.TimeScope
¿?¿?¿? I don´t know what to use or how.
Thank you very much
Posted : 25/06/2021 9:10 pm
Posts: 793
Prominent Member Admin

It was a bit confusing because I missed to update the API documentation when I deprecated LoadScoresByUser, I have updated the documentation right now.

Basically the method LoadScoreByUser that replaced the old LoadScoresByUser is not a static method but you have to call it from an instanced object of Leaderboard, for example:

Leaderboard leaderboard = new Leaderboard { code = "L123" };
leaderboard.LoadScoreByUser(CombuManager.localUser, eLeaderboardInterval.Total, 10, (Score score, int page, string error) =>
    if (!string.IsNullOrEmpty(error))
        Debug.LogError("Loading score failed: " + error);
        // Use score.value (long), score.valueFloat (float) or score.valueDouble (double)
        // depending on the type of score that you know is stored for this leaderboard
        Debug.Log(string.Format("New score rank #{0} with value {1} at page {2}", score.rank, score.value, page));

About platform object, the method that you were calling (CombuManager.platform.LoadScores) has a totally different sign (check it in the script CombuPlatform.cs) and it's used to retrieve the scores pages from a leaderboard not depending on a specific user.


Posted : 29/06/2021 10:00 am
Posts: 6
Active Member
Topic starter

@skaredcreations Thank you very much. I will try it this afternoon. Many many thanks.

LoadScores appears in the example of LoadScoresByUser in the API documentation. Thats why i finally open this thread. I didn´t know really what to use 🙂 

Thank you again for this great asset.

Posted : 29/06/2021 5:12 pm
Posts: 6
Active Member
Topic starter

@skaredcreations All perfect. Thank you very much.

Posted : 30/06/2021 8:25 pm