I noticed that we don’t have this native option, correct?
Therefore, how can I show players from a specific country, and/or global, in the ranking, without filtering countries? Mybe using Tiers? IDK
There is no way to get country. But there is one method I know however, it’s quite expensive. Here are the steps
Service that we need: Leaderboard, Cloud Code, Cloud Save
- In client side, when player sign in for first time, prompt
Select your country
- In client side, save player country info to Cloud Save
- Make Cloud Code with parameter LeaderboardID
- In Cloud Code, write code to get all user of LeaderboardID, the return user will have PlayerID. Check their API Doc
- In Cloud Code, create class
PlayerData
to hold data PlayerID and Country - In Cloud Code, create array to hold PlayerData
- In Cloud Code, foreach PlayerIDs to get
Country
variable from Cloud Save, if you found it, then create newPlayerData
and assignee PlayerID and Country then push to array we created. - In Cloud Code, serialize the array of
PlayerData
to JSON then return it - In client side, make a C# class that contain prop PlayerID and Country
- In client side, try call the cloud code method with param
LeaderboardID
that we created where it will return JSON, then deserialize byJsonConvert.DeserializeObject
- Foreach the return value and filter which country that you want
- Finish
To improve performance, need to cache after we get the leaderboard value, so it will blazing fast.