docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SteamUserStats

    Purpose: Functions for accessing stats, achievements, and leaderboard information

    Inheritance
    object
    SteamUserStats
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Steamworks.Interop
    Assembly: Unity.Steamworks.Interop.dll
    Syntax
    public static class SteamUserStats

    Methods

    AttachLeaderboardUGC(SteamLeaderboard_t, UGCHandle_t)

    Attaches a piece of user generated content the user's entry on a leaderboard. hContent is a handle to a piece of user generated content that was shared using ISteamUserRemoteStorage::FileShare(). This call is asynchronous, with the result returned in LeaderboardUGCSet_t.

    Declaration
    public static SteamAPICall_t AttachLeaderboardUGC(SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::AttachLeaderboardUGC.

    UGCHandle_t hUGC

    Passed through to ISteamUserStats::AttachLeaderboardUGC.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamUserStats::AttachLeaderboardUGC returns.

    AttachLeaderboardUGCAsync(SteamLeaderboard_t, UGCHandle_t)

    Async version of AttachLeaderboardUGC(SteamLeaderboard_t, UGCHandle_t).

    Declaration
    public static Task<LeaderboardUGCSet_t> AttachLeaderboardUGCAsync(SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::AttachLeaderboardUGC.

    UGCHandle_t hUGC

    Passed through to ISteamUserStats::AttachLeaderboardUGC.

    Returns
    Type Description
    Task<LeaderboardUGCSet_t>

    The LeaderboardUGCSet_t Steam reports once the call completes.

    ClearAchievement(string)

    Calls the Steamworks ISteamUserStats::ClearAchievement method.

    Declaration
    public static bool ClearAchievement(string pchName)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::ClearAchievement.

    Returns
    Type Description
    bool

    The value ISteamUserStats::ClearAchievement returns.

    DownloadLeaderboardEntries(SteamLeaderboard_t, ELeaderboardDataRequest, int, int)

    Asks the Steam back-end for a set of rows in the leaderboard. This call is asynchronous, with the result returned in LeaderboardScoresDownloaded_t LeaderboardScoresDownloaded_t will contain a handle to pull the results from GetDownloadedLeaderboardEntries() (below) You can ask for more entries than exist, and it will return as many as do exist. k_ELeaderboardDataRequestGlobal requests rows in the leaderboard from the full table, with nRangeStart & nRangeEnd in the range [1, TotalEntries] k_ELeaderboardDataRequestGlobalAroundUser requests rows around the current user, nRangeStart being negate e.g. DownloadLeaderboardEntries( hLeaderboard, k_ELeaderboardDataRequestGlobalAroundUser, -3, 3 ) will return 7 rows, 3 before the user, 3 after k_ELeaderboardDataRequestFriends requests all the rows for friends of the current user

    Declaration
    public static SteamAPICall_t DownloadLeaderboardEntries(SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::DownloadLeaderboardEntries.

    ELeaderboardDataRequest eLeaderboardDataRequest

    Passed through to ISteamUserStats::DownloadLeaderboardEntries.

    int nRangeStart

    Passed through to ISteamUserStats::DownloadLeaderboardEntries.

    int nRangeEnd

    Passed through to ISteamUserStats::DownloadLeaderboardEntries.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamUserStats::DownloadLeaderboardEntries returns.

    DownloadLeaderboardEntriesAsync(SteamLeaderboard_t, ELeaderboardDataRequest, int, int)

    Async version of DownloadLeaderboardEntries(SteamLeaderboard_t, ELeaderboardDataRequest, int, int).

    Declaration
    public static Task<LeaderboardScoresDownloaded_t> DownloadLeaderboardEntriesAsync(SteamLeaderboard_t hSteamLeaderboard, ELeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::DownloadLeaderboardEntries.

    ELeaderboardDataRequest eLeaderboardDataRequest

    Passed through to ISteamUserStats::DownloadLeaderboardEntries.

    int nRangeStart

    Passed through to ISteamUserStats::DownloadLeaderboardEntries.

    int nRangeEnd

    Passed through to ISteamUserStats::DownloadLeaderboardEntries.

    Returns
    Type Description
    Task<LeaderboardScoresDownloaded_t>

    The LeaderboardScoresDownloaded_t Steam reports once the call completes.

    DownloadLeaderboardEntriesForUsers(SteamLeaderboard_t, CSteamID[], int)

    as above, but downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers if a user doesn't have a leaderboard entry, they won't be included in the result a max of 100 users can be downloaded at a time, with only one outstanding call at a time

    Declaration
    public static SteamAPICall_t DownloadLeaderboardEntriesForUsers(SteamLeaderboard_t hSteamLeaderboard, CSteamID[] prgUsers, int cUsers)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::DownloadLeaderboardEntriesForUsers.

    CSteamID[] prgUsers

    Passed through to ISteamUserStats::DownloadLeaderboardEntriesForUsers.

    int cUsers

    Passed through to ISteamUserStats::DownloadLeaderboardEntriesForUsers.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamUserStats::DownloadLeaderboardEntriesForUsers returns.

    DownloadLeaderboardEntriesForUsersAsync(SteamLeaderboard_t, CSteamID[], int)

    Async version of DownloadLeaderboardEntriesForUsers(SteamLeaderboard_t, CSteamID[], int).

    Declaration
    public static Task<LeaderboardScoresDownloaded_t> DownloadLeaderboardEntriesForUsersAsync(SteamLeaderboard_t hSteamLeaderboard, CSteamID[] prgUsers, int cUsers)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::DownloadLeaderboardEntriesForUsers.

    CSteamID[] prgUsers

    Passed through to ISteamUserStats::DownloadLeaderboardEntriesForUsers.

    int cUsers

    Passed through to ISteamUserStats::DownloadLeaderboardEntriesForUsers.

    Returns
    Type Description
    Task<LeaderboardScoresDownloaded_t>

    The LeaderboardScoresDownloaded_t Steam reports once the call completes.

    FindLeaderboard(string)

    as above, but won't create the leaderboard if it's not found This call is asynchronous, with the result returned in LeaderboardFindResult_t

    Declaration
    public static SteamAPICall_t FindLeaderboard(string pchLeaderboardName)
    Parameters
    Type Name Description
    string pchLeaderboardName

    Passed through to ISteamUserStats::FindLeaderboard.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamUserStats::FindLeaderboard returns.

    FindLeaderboardAsync(string)

    Async version of FindLeaderboard(string).

    Declaration
    public static Task<LeaderboardFindResult_t> FindLeaderboardAsync(string pchLeaderboardName)
    Parameters
    Type Name Description
    string pchLeaderboardName

    Passed through to ISteamUserStats::FindLeaderboard.

    Returns
    Type Description
    Task<LeaderboardFindResult_t>

    The LeaderboardFindResult_t Steam reports once the call completes.

    FindOrCreateLeaderboard(string, ELeaderboardSortMethod, ELeaderboardDisplayType)

    Leaderboard functions asks the Steam back-end for a leaderboard by name, and will create it if it's not yet This call is asynchronous, with the result returned in LeaderboardFindResult_t

    Declaration
    public static SteamAPICall_t FindOrCreateLeaderboard(string pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType)
    Parameters
    Type Name Description
    string pchLeaderboardName

    Passed through to ISteamUserStats::FindOrCreateLeaderboard.

    ELeaderboardSortMethod eLeaderboardSortMethod

    Passed through to ISteamUserStats::FindOrCreateLeaderboard.

    ELeaderboardDisplayType eLeaderboardDisplayType

    Passed through to ISteamUserStats::FindOrCreateLeaderboard.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamUserStats::FindOrCreateLeaderboard returns.

    FindOrCreateLeaderboardAsync(string, ELeaderboardSortMethod, ELeaderboardDisplayType)

    Async version of FindOrCreateLeaderboard(string, ELeaderboardSortMethod, ELeaderboardDisplayType).

    Declaration
    public static Task<LeaderboardFindResult_t> FindOrCreateLeaderboardAsync(string pchLeaderboardName, ELeaderboardSortMethod eLeaderboardSortMethod, ELeaderboardDisplayType eLeaderboardDisplayType)
    Parameters
    Type Name Description
    string pchLeaderboardName

    Passed through to ISteamUserStats::FindOrCreateLeaderboard.

    ELeaderboardSortMethod eLeaderboardSortMethod

    Passed through to ISteamUserStats::FindOrCreateLeaderboard.

    ELeaderboardDisplayType eLeaderboardDisplayType

    Passed through to ISteamUserStats::FindOrCreateLeaderboard.

    Returns
    Type Description
    Task<LeaderboardFindResult_t>

    The LeaderboardFindResult_t Steam reports once the call completes.

    GetAchievement(string, out bool)

    Achievement flag accessors

    Declaration
    public static bool GetAchievement(string pchName, out bool pbAchieved)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::GetAchievement.

    bool pbAchieved

    Passed through to ISteamUserStats::GetAchievement.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetAchievement returns.

    GetAchievementAchievedPercent(string, out float)

    Returns the percentage of users who have achieved the specified achievement.

    Declaration
    public static bool GetAchievementAchievedPercent(string pchName, out float pflPercent)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::GetAchievementAchievedPercent.

    float pflPercent

    Passed through to ISteamUserStats::GetAchievementAchievedPercent.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetAchievementAchievedPercent returns.

    GetAchievementAndUnlockTime(string, out bool, out uint)

    Get the achievement status, and the time it was unlocked if unlocked. If the return value is true, but the unlock time is zero, that means it was unlocked before Steam began tracking achievement unlock times (December 2009). Time is seconds since January 1, 1970.

    Declaration
    public static bool GetAchievementAndUnlockTime(string pchName, out bool pbAchieved, out uint punUnlockTime)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::GetAchievementAndUnlockTime.

    bool pbAchieved

    Passed through to ISteamUserStats::GetAchievementAndUnlockTime.

    uint punUnlockTime

    Passed through to ISteamUserStats::GetAchievementAndUnlockTime.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetAchievementAndUnlockTime returns.

    GetAchievementDisplayAttribute(string, string)

    Get general attributes for an achievement. Accepts the following keys:

    • "name" and "desc" for retrieving the localized achievement name and description (returned in UTF8)
    • "hidden" for retrieving if an achievement is hidden (returns "0" when not hidden, "1" when hidden)
    Declaration
    public static string GetAchievementDisplayAttribute(string pchName, string pchKey)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::GetAchievementDisplayAttribute.

    string pchKey

    Passed through to ISteamUserStats::GetAchievementDisplayAttribute.

    Returns
    Type Description
    string

    The value ISteamUserStats::GetAchievementDisplayAttribute returns.

    GetAchievementIcon(string)

    Achievement / GroupAchievement metadata Gets the icon of the achievement, which is a handle to be used in ISteamUtils::GetImageRGBA(), or 0 if none set. A return value of 0 may indicate we are still fetching data, and you can wait for the UserAchievementIconFetched_t callback which will notify you when the bits are ready. If the callback still returns zero, then there is no image set for the specified achievement.

    Declaration
    public static int GetAchievementIcon(string pchName)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::GetAchievementIcon.

    Returns
    Type Description
    int

    The value ISteamUserStats::GetAchievementIcon returns.

    GetAchievementName(uint)

    Get achievement name iAchievement in [0,GetNumAchievements)

    Declaration
    public static string GetAchievementName(uint iAchievement)
    Parameters
    Type Name Description
    uint iAchievement

    Passed through to ISteamUserStats::GetAchievementName.

    Returns
    Type Description
    string

    The value ISteamUserStats::GetAchievementName returns.

    GetAchievementProgressLimits(string, out int, out int)

    Calls the Steamworks ISteamUserStats::GetAchievementProgressLimits method.

    Declaration
    public static bool GetAchievementProgressLimits(string pchName, out int pnMinProgress, out int pnMaxProgress)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::GetAchievementProgressLimits.

    int pnMinProgress

    Passed through to ISteamUserStats::GetAchievementProgressLimits.

    int pnMaxProgress

    Passed through to ISteamUserStats::GetAchievementProgressLimits.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetAchievementProgressLimits returns.

    GetAchievementProgressLimits(string, out float, out float)

    Calls the Steamworks ISteamUserStats::GetAchievementProgressLimits method.

    Declaration
    public static bool GetAchievementProgressLimits(string pchName, out float pfMinProgress, out float pfMaxProgress)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::GetAchievementProgressLimits.

    float pfMinProgress

    Passed through to ISteamUserStats::GetAchievementProgressLimits.

    float pfMaxProgress

    Passed through to ISteamUserStats::GetAchievementProgressLimits.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetAchievementProgressLimits returns.

    GetDownloadedLeaderboardEntry(SteamLeaderboardEntries_t, int, out LeaderboardEntry_t, int[], int)

    Returns data about a single leaderboard entry use a for loop from 0 to LeaderboardScoresDownloaded_t::m_cEntryCount to get all the downloaded entries e.g. void OnLeaderboardScoresDownloaded( LeaderboardScoresDownloaded_t *pLeaderboardScoresDownloaded ) { for ( int index = 0; index < pLeaderboardScoresDownloaded->m_cEntryCount; index++ ) { LeaderboardEntry_t leaderboardEntry; int32 details[3]; // we know this is how many we've stored previously GetDownloadedLeaderboardEntry( pLeaderboardScoresDownloaded->m_hSteamLeaderboardEntries, index, &leaderboardEntry, details, 3 ); assert( leaderboardEntry.m_cDetails == 3 ); ... } once you've accessed all the entries, the data will be free'd, and the SteamLeaderboardEntries_t handle will become invalid

    Declaration
    public static bool GetDownloadedLeaderboardEntry(SteamLeaderboardEntries_t hSteamLeaderboardEntries, int index, out LeaderboardEntry_t pLeaderboardEntry, int[] pDetails, int cDetailsMax)
    Parameters
    Type Name Description
    SteamLeaderboardEntries_t hSteamLeaderboardEntries

    Passed through to ISteamUserStats::GetDownloadedLeaderboardEntry.

    int index

    Passed through to ISteamUserStats::GetDownloadedLeaderboardEntry.

    LeaderboardEntry_t pLeaderboardEntry

    Passed through to ISteamUserStats::GetDownloadedLeaderboardEntry.

    int[] pDetails

    Passed through to ISteamUserStats::GetDownloadedLeaderboardEntry.

    int cDetailsMax

    Passed through to ISteamUserStats::GetDownloadedLeaderboardEntry.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetDownloadedLeaderboardEntry returns.

    GetGlobalStat(string, out double)

    Calls the Steamworks ISteamUserStats::GetGlobalStat method.

    Declaration
    public static bool GetGlobalStat(string pchStatName, out double pData)
    Parameters
    Type Name Description
    string pchStatName

    Passed through to ISteamUserStats::GetGlobalStat.

    double pData

    Passed through to ISteamUserStats::GetGlobalStat.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetGlobalStat returns.

    GetGlobalStat(string, out long)

    Calls the Steamworks ISteamUserStats::GetGlobalStat method.

    Declaration
    public static bool GetGlobalStat(string pchStatName, out long pData)
    Parameters
    Type Name Description
    string pchStatName

    Passed through to ISteamUserStats::GetGlobalStat.

    long pData

    Passed through to ISteamUserStats::GetGlobalStat.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetGlobalStat returns.

    GetGlobalStatHistory(string, double[], uint)

    Calls the Steamworks ISteamUserStats::GetGlobalStatHistory method.

    Declaration
    public static int GetGlobalStatHistory(string pchStatName, double[] pData, uint cubData)
    Parameters
    Type Name Description
    string pchStatName

    Passed through to ISteamUserStats::GetGlobalStatHistory.

    double[] pData

    Passed through to ISteamUserStats::GetGlobalStatHistory.

    uint cubData

    Passed through to ISteamUserStats::GetGlobalStatHistory.

    Returns
    Type Description
    int

    The value ISteamUserStats::GetGlobalStatHistory returns.

    GetGlobalStatHistory(string, long[], uint)

    Calls the Steamworks ISteamUserStats::GetGlobalStatHistory method.

    Declaration
    public static int GetGlobalStatHistory(string pchStatName, long[] pData, uint cubData)
    Parameters
    Type Name Description
    string pchStatName

    Passed through to ISteamUserStats::GetGlobalStatHistory.

    long[] pData

    Passed through to ISteamUserStats::GetGlobalStatHistory.

    uint cubData

    Passed through to ISteamUserStats::GetGlobalStatHistory.

    Returns
    Type Description
    int

    The value ISteamUserStats::GetGlobalStatHistory returns.

    GetLeaderboardDisplayType(SteamLeaderboard_t)

    returns the display type of the leaderboard

    Declaration
    public static ELeaderboardDisplayType GetLeaderboardDisplayType(SteamLeaderboard_t hSteamLeaderboard)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::GetLeaderboardDisplayType.

    Returns
    Type Description
    ELeaderboardDisplayType

    The value ISteamUserStats::GetLeaderboardDisplayType returns.

    GetLeaderboardEntryCount(SteamLeaderboard_t)

    returns the total number of entries in a leaderboard, as of the last request

    Declaration
    public static int GetLeaderboardEntryCount(SteamLeaderboard_t hSteamLeaderboard)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::GetLeaderboardEntryCount.

    Returns
    Type Description
    int

    The value ISteamUserStats::GetLeaderboardEntryCount returns.

    GetLeaderboardName(SteamLeaderboard_t)

    returns the name of a leaderboard

    Declaration
    public static string GetLeaderboardName(SteamLeaderboard_t hSteamLeaderboard)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::GetLeaderboardName.

    Returns
    Type Description
    string

    The value ISteamUserStats::GetLeaderboardName returns.

    GetLeaderboardSortMethod(SteamLeaderboard_t)

    returns the sort method of the leaderboard

    Declaration
    public static ELeaderboardSortMethod GetLeaderboardSortMethod(SteamLeaderboard_t hSteamLeaderboard)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::GetLeaderboardSortMethod.

    Returns
    Type Description
    ELeaderboardSortMethod

    The value ISteamUserStats::GetLeaderboardSortMethod returns.

    GetMostAchievedAchievementInfo(out string, uint, out float, out bool)

    Get the info on the most achieved achievement for the game, returns an iterator index you can use to fetch the next most achieved afterwards. Will return -1 if there is no data on achievement percentages (ie, you haven't called RequestGlobalAchievementPercentages and waited on the callback).

    Declaration
    public static int GetMostAchievedAchievementInfo(out string pchName, uint unNameBufLen, out float pflPercent, out bool pbAchieved)
    Parameters
    Type Name Description
    string pchName

    Receives the string ISteamUserStats::GetMostAchievedAchievementInfo writes.

    uint unNameBufLen

    Passed through to ISteamUserStats::GetMostAchievedAchievementInfo.

    float pflPercent

    Passed through to ISteamUserStats::GetMostAchievedAchievementInfo.

    bool pbAchieved

    Passed through to ISteamUserStats::GetMostAchievedAchievementInfo.

    Returns
    Type Description
    int

    The value ISteamUserStats::GetMostAchievedAchievementInfo returns.

    GetNextMostAchievedAchievementInfo(int, out string, uint, out float, out bool)

    Get the info on the next most achieved achievement for the game. Call this after GetMostAchievedAchievementInfo or another GetNextMostAchievedAchievementInfo call passing the iterator from the previous call. Returns -1 after the last achievement has been iterated.

    Declaration
    public static int GetNextMostAchievedAchievementInfo(int iIteratorPrevious, out string pchName, uint unNameBufLen, out float pflPercent, out bool pbAchieved)
    Parameters
    Type Name Description
    int iIteratorPrevious

    Passed through to ISteamUserStats::GetNextMostAchievedAchievementInfo.

    string pchName

    Receives the string ISteamUserStats::GetNextMostAchievedAchievementInfo writes.

    uint unNameBufLen

    Passed through to ISteamUserStats::GetNextMostAchievedAchievementInfo.

    float pflPercent

    Passed through to ISteamUserStats::GetNextMostAchievedAchievementInfo.

    bool pbAchieved

    Passed through to ISteamUserStats::GetNextMostAchievedAchievementInfo.

    Returns
    Type Description
    int

    The value ISteamUserStats::GetNextMostAchievedAchievementInfo returns.

    GetNumAchievements()

    Used for iterating achievements. In general games should not need these functions because they should have a list of existing achievements compiled into them

    Declaration
    public static uint GetNumAchievements()
    Returns
    Type Description
    uint

    The value ISteamUserStats::GetNumAchievements returns.

    GetNumberOfCurrentPlayers()

    Retrieves the number of players currently playing your game (online + offline) This call is asynchronous, with the result returned in NumberOfCurrentPlayers_t

    Declaration
    public static SteamAPICall_t GetNumberOfCurrentPlayers()
    Returns
    Type Description
    SteamAPICall_t

    The value ISteamUserStats::GetNumberOfCurrentPlayers returns.

    GetNumberOfCurrentPlayersAsync()

    Async version of GetNumberOfCurrentPlayers().

    Declaration
    public static Task<NumberOfCurrentPlayers_t> GetNumberOfCurrentPlayersAsync()
    Returns
    Type Description
    Task<NumberOfCurrentPlayers_t>

    The NumberOfCurrentPlayers_t Steam reports once the call completes.

    GetStat(string, out int)

    Calls the Steamworks ISteamUserStats::GetStat method.

    Declaration
    public static bool GetStat(string pchName, out int pData)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::GetStat.

    int pData

    Passed through to ISteamUserStats::GetStat.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetStat returns.

    GetStat(string, out float)

    Calls the Steamworks ISteamUserStats::GetStat method.

    Declaration
    public static bool GetStat(string pchName, out float pData)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::GetStat.

    float pData

    Passed through to ISteamUserStats::GetStat.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetStat returns.

    GetUserAchievement(CSteamID, string, out bool)

    Calls the Steamworks ISteamUserStats::GetUserAchievement method.

    Declaration
    public static bool GetUserAchievement(CSteamID steamIDUser, string pchName, out bool pbAchieved)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamUserStats::GetUserAchievement.

    string pchName

    Passed through to ISteamUserStats::GetUserAchievement.

    bool pbAchieved

    Passed through to ISteamUserStats::GetUserAchievement.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetUserAchievement returns.

    GetUserAchievementAndUnlockTime(CSteamID, string, out bool, out uint)

    See notes for GetAchievementAndUnlockTime above

    Declaration
    public static bool GetUserAchievementAndUnlockTime(CSteamID steamIDUser, string pchName, out bool pbAchieved, out uint punUnlockTime)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamUserStats::GetUserAchievementAndUnlockTime.

    string pchName

    Passed through to ISteamUserStats::GetUserAchievementAndUnlockTime.

    bool pbAchieved

    Passed through to ISteamUserStats::GetUserAchievementAndUnlockTime.

    uint punUnlockTime

    Passed through to ISteamUserStats::GetUserAchievementAndUnlockTime.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetUserAchievementAndUnlockTime returns.

    GetUserStat(CSteamID, string, out int)

    Calls the Steamworks ISteamUserStats::GetUserStat method.

    Declaration
    public static bool GetUserStat(CSteamID steamIDUser, string pchName, out int pData)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamUserStats::GetUserStat.

    string pchName

    Passed through to ISteamUserStats::GetUserStat.

    int pData

    Passed through to ISteamUserStats::GetUserStat.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetUserStat returns.

    GetUserStat(CSteamID, string, out float)

    Calls the Steamworks ISteamUserStats::GetUserStat method.

    Declaration
    public static bool GetUserStat(CSteamID steamIDUser, string pchName, out float pData)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamUserStats::GetUserStat.

    string pchName

    Passed through to ISteamUserStats::GetUserStat.

    float pData

    Passed through to ISteamUserStats::GetUserStat.

    Returns
    Type Description
    bool

    The value ISteamUserStats::GetUserStat returns.

    IndicateAchievementProgress(string, uint, uint)

    Achievement progress - triggers an AchievementProgress callback, that is all. Calling this w/ N out of N progress will NOT set the achievement, the game must still do that.

    Declaration
    public static bool IndicateAchievementProgress(string pchName, uint nCurProgress, uint nMaxProgress)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::IndicateAchievementProgress.

    uint nCurProgress

    Passed through to ISteamUserStats::IndicateAchievementProgress.

    uint nMaxProgress

    Passed through to ISteamUserStats::IndicateAchievementProgress.

    Returns
    Type Description
    bool

    The value ISteamUserStats::IndicateAchievementProgress returns.

    RequestGlobalAchievementPercentages()

    Requests that Steam fetch data on the percentage of players who have received each achievement for the game globally. This call is asynchronous, with the result returned in GlobalAchievementPercentagesReady_t.

    Declaration
    public static SteamAPICall_t RequestGlobalAchievementPercentages()
    Returns
    Type Description
    SteamAPICall_t

    The value ISteamUserStats::RequestGlobalAchievementPercentages returns.

    RequestGlobalAchievementPercentagesAsync()

    Async version of RequestGlobalAchievementPercentages().

    Declaration
    public static Task<GlobalAchievementPercentagesReady_t> RequestGlobalAchievementPercentagesAsync()
    Returns
    Type Description
    Task<GlobalAchievementPercentagesReady_t>

    The GlobalAchievementPercentagesReady_t Steam reports once the call completes.

    RequestGlobalStats(int)

    Requests global stats data, which is available for stats marked as "aggregated". This call is asynchronous, with the results returned in GlobalStatsReceived_t. nHistoryDays specifies how many days of day-by-day history to retrieve in addition to the overall totals. The limit is 60.

    Declaration
    public static SteamAPICall_t RequestGlobalStats(int nHistoryDays)
    Parameters
    Type Name Description
    int nHistoryDays

    Passed through to ISteamUserStats::RequestGlobalStats.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamUserStats::RequestGlobalStats returns.

    RequestGlobalStatsAsync(int)

    Async version of RequestGlobalStats(int).

    Declaration
    public static Task<GlobalStatsReceived_t> RequestGlobalStatsAsync(int nHistoryDays)
    Parameters
    Type Name Description
    int nHistoryDays

    Passed through to ISteamUserStats::RequestGlobalStats.

    Returns
    Type Description
    Task<GlobalStatsReceived_t>

    The GlobalStatsReceived_t Steam reports once the call completes.

    RequestUserStats(CSteamID)

    Friends stats & achievements downloads stats for the user returns a UserStatsReceived_t received when completed if the other user has no stats, UserStatsReceived_t.m_eResult will be set to k_EResultFail these stats won't be auto-updated; you'll need to call RequestUserStats() again to refresh any data

    Declaration
    public static SteamAPICall_t RequestUserStats(CSteamID steamIDUser)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamUserStats::RequestUserStats.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamUserStats::RequestUserStats returns.

    RequestUserStatsAsync(CSteamID)

    Async version of RequestUserStats(CSteamID).

    Declaration
    public static Task<UserStatsReceived_t> RequestUserStatsAsync(CSteamID steamIDUser)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamUserStats::RequestUserStats.

    Returns
    Type Description
    Task<UserStatsReceived_t>

    The UserStatsReceived_t Steam reports once the call completes.

    ResetAllStats(bool)

    Reset stats

    Declaration
    public static bool ResetAllStats(bool bAchievementsToo)
    Parameters
    Type Name Description
    bool bAchievementsToo

    Passed through to ISteamUserStats::ResetAllStats.

    Returns
    Type Description
    bool

    The value ISteamUserStats::ResetAllStats returns.

    SetAchievement(string)

    Calls the Steamworks ISteamUserStats::SetAchievement method.

    Declaration
    public static bool SetAchievement(string pchName)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::SetAchievement.

    Returns
    Type Description
    bool

    The value ISteamUserStats::SetAchievement returns.

    SetStat(string, int)

    Calls the Steamworks ISteamUserStats::SetStat method.

    Declaration
    public static bool SetStat(string pchName, int nData)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::SetStat.

    int nData

    Passed through to ISteamUserStats::SetStat.

    Returns
    Type Description
    bool

    The value ISteamUserStats::SetStat returns.

    SetStat(string, float)

    Calls the Steamworks ISteamUserStats::SetStat method.

    Declaration
    public static bool SetStat(string pchName, float fData)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::SetStat.

    float fData

    Passed through to ISteamUserStats::SetStat.

    Returns
    Type Description
    bool

    The value ISteamUserStats::SetStat returns.

    StoreStats()

    Store the current data on the server, will get a callback when set And one callback for every new achievement If the callback has a result of k_EResultInvalidParam, one or more stats uploaded has been rejected, either because they broke constraints or were out of date. In this case the server sends back updated values. The stats should be re-iterated to keep in sync.

    Declaration
    public static bool StoreStats()
    Returns
    Type Description
    bool

    The value ISteamUserStats::StoreStats returns.

    UpdateAvgRateStat(string, float, double)

    Calls the Steamworks ISteamUserStats::UpdateAvgRateStat method.

    Declaration
    public static bool UpdateAvgRateStat(string pchName, float flCountThisSession, double dSessionLength)
    Parameters
    Type Name Description
    string pchName

    Passed through to ISteamUserStats::UpdateAvgRateStat.

    float flCountThisSession

    Passed through to ISteamUserStats::UpdateAvgRateStat.

    double dSessionLength

    Passed through to ISteamUserStats::UpdateAvgRateStat.

    Returns
    Type Description
    bool

    The value ISteamUserStats::UpdateAvgRateStat returns.

    UploadLeaderboardScore(SteamLeaderboard_t, ELeaderboardUploadScoreMethod, int, int[], int)

    Uploads a user score to the Steam back-end. This call is asynchronous, with the result returned in LeaderboardScoreUploaded_t Details are extra game-defined information regarding how the user got that score pScoreDetails points to an array of int32's, cScoreDetailsCount is the number of int32's in the list

    Declaration
    public static SteamAPICall_t UploadLeaderboardScore(SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int nScore, int[] pScoreDetails, int cScoreDetailsCount)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::UploadLeaderboardScore.

    ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod

    Passed through to ISteamUserStats::UploadLeaderboardScore.

    int nScore

    Passed through to ISteamUserStats::UploadLeaderboardScore.

    int[] pScoreDetails

    Passed through to ISteamUserStats::UploadLeaderboardScore.

    int cScoreDetailsCount

    Passed through to ISteamUserStats::UploadLeaderboardScore.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamUserStats::UploadLeaderboardScore returns.

    UploadLeaderboardScoreAsync(SteamLeaderboard_t, ELeaderboardUploadScoreMethod, int, int[], int)

    Async version of UploadLeaderboardScore(SteamLeaderboard_t, ELeaderboardUploadScoreMethod, int, int[], int).

    Declaration
    public static Task<LeaderboardScoreUploaded_t> UploadLeaderboardScoreAsync(SteamLeaderboard_t hSteamLeaderboard, ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int nScore, int[] pScoreDetails, int cScoreDetailsCount)
    Parameters
    Type Name Description
    SteamLeaderboard_t hSteamLeaderboard

    Passed through to ISteamUserStats::UploadLeaderboardScore.

    ELeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod

    Passed through to ISteamUserStats::UploadLeaderboardScore.

    int nScore

    Passed through to ISteamUserStats::UploadLeaderboardScore.

    int[] pScoreDetails

    Passed through to ISteamUserStats::UploadLeaderboardScore.

    int cScoreDetailsCount

    Passed through to ISteamUserStats::UploadLeaderboardScore.

    Returns
    Type Description
    Task<LeaderboardScoreUploaded_t>

    The LeaderboardScoreUploaded_t Steam reports once the call completes.

    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)