Leaderboard Manager
The leader in board ๐
Like what your seeing?
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!
Introduction
This tool simply exposes features present in the API to the inspector.
This is not required to use these features it is simply a helper tool allowing user's who are more comfortable working with editor inspectors and game object rather than classic C# objects and scripting to make use of the related feature.
Meant to be added to a game object at or near your leaderboard UI, this behaviour can help you display leaderboard entries and simplifies the process of uploading scores to a leaderboard.
Namespace
Definition
Events
evtUserEntryUpdated
Occurs when the local user's last known user entry is updated. This can only be raised by operations ran from within the Leaderboard Manager ... for example if you call the RefreshUserEntry or GetUserEntries. Then it is likely to be raised assuming the local user has an entry however if you manually query the board using API.Leaderboards or other methods it will not be raised.
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
Assuming leaderboardManager
is reference to your Leaderboard Manager.
When you no longer need this handler you should remove it for example when the behaviour using it is destroyed
evtQueryCompleted
Occurs when a query for records complets and contains the results of that query.
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
Assuming leaderboardManager
is reference to your Leaderboard Manager.
When you no longer need this handler you should remove it for example when the behaviour using it is destroyed
evtQueryError
Occurs when a query fails with an error, errors are not generally specified rather it is up to you to check for logical causes such as the leaderboard being null or not being valid.
You would add a listener on this event such as:
Assuming leaderboardManager
is reference to your Leaderboard Manager.
Assuming a handler in the form of
Then you would register the event such as:
When you no longer need this handler you should remove it for example when the behaviour using it is destroyed
evtUploadError
Occurs when an attempt to upload scores fails. As with query errors the API doesn't usually provide any additional information. The typical causes are an invalid board or a board that can only be set by the Web API.
You would add a listener on this event such as:
Assuming a handler in the form of
Then you would register the event such as:
Assuming leaderboardManager
is reference to your Leaderboard Manager.
When you no longer need this handler you should remove it for example when the behaviour using it is destroyed
Fields and Attributes
leaderboard
Set this to the leaderboard you want this manager to "manage"
LastKnownUserEntry
The entry for the local user if known, this will be updated any time you recieve informartion from Steam as to the user's current rank/score.
Methods
Refresh User Entry
Queries the board for the local user's entry.
Get Top Entries
Queries the board for the top X number of entries.
Get Near by Entries
Queries the board for entries around the player, before is the number entries before the player's entry and after is the number after the user's entry.
Both values should be entered as positive whole numbers.
Get All Friends entries
This will return all entries for all friends that have an entry in this board.
Get User Entries
This will return entries for each of the indicated user's if they have an entry to return.
Upload Score
and
This will upload a score to the leaderboard for the user, optionally you can provide an array of details.
and
Similar to UploadScore, this will force the user's score to be this new value even if the old score was a better score. This is typically used to reset a user's score on the board.
Last updated