Description
An example that includes a leaderboard prefab that uses persistent PlayerData and a simple example of how to use it.
How it Works
There’s a Leaderboard script where you can add any key you want players to be ordered by. Works with Float and Int.
Then there’s also a LeaderboardSlot script which is a RectTransform. This is a Player Object which means one will be created for each player joining. When the object is created it’s automatically added to Scroll View defined by the Leaderboard. The Scroll Views Content transform has a Vertical Layout Group which makes all children of it automatically sort by the order they are in the heirarchy. The Leaderboard script will update the position of the LeaderboardSlot in the heirarchy each time their persistant score according to the key assigned changes.
How to use this example
Open the Leaderboard scene. Then enter play mode and your name should be on the leaderboard with 0 score. Jump and your score should increase. Then stop the scene and then play the scene again. You should once again be on the leaderboard but this time your score should be remembered from the previous play session.