Page cover

Leaderboard Data

Like what your seeing?

Introduction

using HeathenEngineering.SteamworksIntegration;
public struct LeaderboardData : IEquatable<SteamLeaderboard_t>, 
                                IEquatable<ulong>, 
                                IEquatable<string>

A simple struct that provides easy access to a given leaderboard's features and data. The structure is convertible to and from the native and primitive data types for a Steam Leaderboard

LeaderboardData fromNative = new SteamLeaderboard_t(123456789);
LeaderboardData fromPrimative = 123456789;

Get methods are provided for users that prefer that approach

LeaderboardData fromNative = LeaderboardData.Get(new SteamLeaderboard_t(123456789));
LeaderboardData fromPrimative = LeaderboardData.Get(123456789);

A Get method with callback can be used to look up the ID and return the resulting board based on its name. This being asynchronous does require the use of a callback;

LeaderboardData.Get("boardName", (result, ioError) => {
    if(ioError)
        Debug.Log($"IO Error encountered when searching for boardName");
    else if (result.Valid)
        Debug.Log($"We found the board and its ready to use");
    else
        Debug.Log("No error, but no such board found");
});

Fields and Attributes

API Name

Only set when getting a leaderboard by its name, this is the API name used to look up the leaderboard's ID on the Steam API.

Id

The native Steam API ID for this leaderboard. Typically this is found by searching for a board by its name. If you define your boards in the SteamSettings object these will all be found and loaded for you on start up.

Display Name

Returns the display for the board if the board is valid.

Valid

Returns true if the board ID is valid, this does not insure the ID is correct only that its non-default. If you set an incorrect valid here that is greater than zero this will be true but obviously not a real Leaderboard.

Entry Count

Returns the total number of entries available for this board

Methods

Get User Entry

Queries for the local user's entry on this board and invokes the callback when and if found.

  • maxDetailEntries This indicates how many if any detail entries should be read for each entry on the board. To understand detail entries better please read the article on Steam Leaderboards.

  • callback A method to be invoked when the process completes

The callback should take the form of

Get Top Entries

Queries the leaderboard for the top number of entries.

  • count How many top records should be read

  • maxDetailEntries This indicates how many if any detail entries should be read for each entry on the board. To understand detail entries better please read the article on Steam Leaderboards.

  • callback A method to be invoked when the process completes

The callback should take the form of

Get All Entries

Returns all entries on this board

  • maxDetailEntries This indicates how many if any detail entries should be read for each entry on the board. To understand detail entries better please read the article on Steam Leaderboards.

  • callback A method to be invoked when the process completes

The callback should take the form of

Get Entries

  • request The type of query you want to run ... See ELeaderboardDataRequest for details

  • start The index to start downloading entries.

  • end The index to stop downloading entries.

  • maxDetailEntries This indicates how many if any detail entries should be read for each entry on the board. To understand detail entries better please read the article on Steam Leaderboards.

  • callback A method to be invoked when the process completes

  • users The set of users you want to read records for.

  • maxDetailEntries This indicates how many if any detail entries should be read for each entry on the board. To understand detail entries better please read the article on Steam Leaderboards.

  • callback A method to be invoked when the process completes

The callback should take the form of

Get

An asynchronous look up to get a leaderboard based on its API name

  • name The API name of the board to find

  • callback a method to be invoked when the process completes

The callback should take the form of

Converts a ulong ID value into a LeaderboardData object

Converts a SteamLeaderboard_t id into a LeaderboardData object

Get or Create

Searches for a board and returns it if found, if not found it will create a board by that name.

The callback should take the form of

Upload Score

  • score The score to upload

  • scoreDetails Additional details to add to the entry if accepted

  • method The ELeaderboardUploadScoreMethod to be used on upload

  • callback A method to be invoked when the process completes

The callback should take the form of

Attach UGC

  • fileName The name of the file to be saved, this is only used when created the file and can be removed or changed later without breaking the entry on the board

  • jsonObject Any "Serializable" object, we use Unity's JsonUtility to serialize your object to JSON for writing.

  • encoding (optional) the encoding method you want to use, if not provided we will use UTF8

  • callback A method to be invoked when the process completes

The callback should take the form of

Last updated