I am new to GameSparks and I am just combing through the Documentation, Tutorials, API and Forums trying to understand the proper ways for getting the data I need for my game. I am developing the game in Unity. For example, I want to get the rank for the current player. Here are the two methods I found that work:
public void GetLeaderboardScore(string _boardShortCode)
{
new GetLeaderboardEntriesRequest()
.SetLeaderboards(new List<string>() { _boardShortCode })
.Send((response) =>
{
if (!response.HasErrors)
{
// Method 1
GSData data = (GSData)response.JSONData[_boardShortCode];
Debug.Log("Current Player Rank: " + data.GetNumber("rank").ToString());
// Method 2
Debug.Log("Current Player Rank: " + response.BaseData.GetGSData(_boardShortCode).GetNumber("rank").ToString());
}
else
{
Debug.Log("Error: Could not get leaderboard score!");
}
});
}
Now, perhaps I am not going about obtaining this data in the best/fastest way. How else could I get this data?
Also, I can not find documentation on the GSData class and its inherited members or functions. If this exists, could you please point me to it?
Thanks!
Kevin
Best Answer
C
Customer Support
said
almost 2 years ago
Hi Kevin,
Either method is correct, though most users end up using the second method, in which you parse the response as GSData and extract specific keys from that point onwards.
We don't have specific documentation for the GSData class, though we should be adding this in the future.
-Pádraig
1 Comment
Customer Support
said
almost 2 years ago
Answer
Hi Kevin,
Either method is correct, though most users end up using the second method, in which you parse the response as GSData and extract specific keys from that point onwards.
We don't have specific documentation for the GSData class, though we should be adding this in the future.
Kevin Douglass
I am new to GameSparks and I am just combing through the Documentation, Tutorials, API and Forums trying to understand the proper ways for getting the data I need for my game. I am developing the game in Unity. For example, I want to get the rank for the current player. Here are the two methods I found that work:
Now, perhaps I am not going about obtaining this data in the best/fastest way. How else could I get this data?
Also, I can not find documentation on the GSData class and its inherited members or functions. If this exists, could you please point me to it?
Thanks!
Kevin
Hi Kevin,
Either method is correct, though most users end up using the second method, in which you parse the response as GSData and extract specific keys from that point onwards.
We don't have specific documentation for the GSData class, though we should be adding this in the future.
-Pádraig
Customer Support
Hi Kevin,
Either method is correct, though most users end up using the second method, in which you parse the response as GSData and extract specific keys from that point onwards.
We don't have specific documentation for the GSData class, though we should be adding this in the future.
-Pádraig
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2341 topics