Sign In Register

How can we help you today?

Start a new topic

Retrieving rank data from LeaderboardsEntriesRequest

Hi everybody,

What is the way you retrieve the rank for the current player for a leaderboard? I've tried a lot of methods but none of the below work... Using Unity 2017.3 and C#

List<string> lbShortCode = new List<string>();

	new LeaderboardsEntriesRequest().
	Send((response) =>
		if (!response.HasErrors)

			Debug.Log(response.JSONString); // contains the information I need
			Debug.Log(response.Results.GetGSData(lbShortCode[0]).GetNumber("rank").GetValueOrDefault()); // null
			Debug.Log(response.ScriptData.GetGSData(lbShortCode[0]).GetNumber("rank").GetValueOrDefault()); // null
			Debug.Log(response.BaseData.GetGSData(lbShortCode[0]).GetNumber("rank").GetValueOrDefault()); // null

  The JSONData contains the information I want. Is the only way via a JSON parser? If so, then why are all these other options even available? One would just expect the Results object to contain the results... Why is such a trivial task so hard? From what I could find in the docs it says the rank should be in ScriptData, but nope, doesn't work.

Don't get me wrong, I love the functionality GameSparks gives me, but so many features seem cluttered with stuff that doesn't do anything, or features that are poorly documented. 

Maybe I'm missing something basic about how the SDK works, any help is appreciated.


3 people have this question

Ok, so I figured something out.

I was using LeaderBoardEntriesRequest instead of GetLeaderBoardEntriesRequest.

Both returned ALMOST exactly the same JSON:




 As you can see, the only difference being LeaderBoardsEntriesRequest has [ ] enclosing the values.

So I got it working now... but my question is. Why (!) does LeaderBoardsEntriesRequest exist?! It has gotten me confused for 2 days.


I've been stuck with the same thing. I can see the rank in the console log, but I am stumped as to how to get the actual int from that data. Can you tell me how?



Login to post a comment