Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!
The Leaderboard sample scene demonstrates the read, write and display of Leaderboard data. The sample scene doesn't use any custom code and works "code free" using standard Heathen tools.
Located on the Manager GameObject in the scene root. Steamworks Behaviour is required for the Steam API to work at all. Typically this would be in your Bootstrap scene however for the case of these samples which are meant to be ran in editor we place them here.
In the case of this sample we are using the Evt Steam Initialized event on the behaviour to trigger the initial query on the Leaderboard Manager and refresh the Leaderboard User Entry.
Located on the Canvas > Leaderboard Scroll View GameObject. The Leaderboard Manager is responsible for managing a specific leaderboard and facilitates queries against that board.
The 3 buttons arranged above the display area simply call methods on the Leaderboard Manager to start query processes. The Leaderboard Manager's Evt Query Completed event will be raised as each query completes and will call the Leaderboard UI List's Display method causing the results to be displayed in the UI.
Located on the Canvas > Leaderboard Scroll View GameObject. The Leaderboard UI List is responsible for consuming query results and displaying the records on the UI.
This is done by instantiating the Leaderboard Entry UI Record which uses the LeaderboardEntryUIRecord component to set UI elements according to the provided LeaderboardEntry value.
Located on the Canvas > Leaderboard Scroll View > Template > Leaderboard Entry UI Record GameObject. The Leaderboard Entry UI Record is instantiated by the Leaderboard UI List for each record it is provided.
At the bottom of the screen you will see a red box with a few few self explanatory buttons. Those buttons use the LeaderboardObject to clear or update the score of the user on the leaderboard in question.
To the right you will notice a display that updates in real time as the user's score is changed. The Developer Cheat Box > User Leaderboard Entry GameObject is using the LeaderboardUserEntry component to update the score and rank label's for the user on this board. This component reacts to changes on the board and updates the values as required and can be refreshed on demand if desired.