docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SteamGameServerStats

    Purpose: Functions for authenticating users via Steam to play on a game server

    Inheritance
    object
    SteamGameServerStats
    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 SteamGameServerStats

    Methods

    ClearUserAchievement(CSteamID, string)

    Calls the Steamworks ISteamGameServerStats::ClearUserAchievement method.

    Declaration
    public static bool ClearUserAchievement(CSteamID steamIDUser, string pchName)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamGameServerStats::ClearUserAchievement.

    string pchName

    Passed through to ISteamGameServerStats::ClearUserAchievement.

    Returns
    Type Description
    bool

    The value ISteamGameServerStats::ClearUserAchievement returns.

    GetUserAchievement(CSteamID, string, out bool)

    Calls the Steamworks ISteamGameServerStats::GetUserAchievement method.

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

    Passed through to ISteamGameServerStats::GetUserAchievement.

    string pchName

    Passed through to ISteamGameServerStats::GetUserAchievement.

    bool pbAchieved

    Passed through to ISteamGameServerStats::GetUserAchievement.

    Returns
    Type Description
    bool

    The value ISteamGameServerStats::GetUserAchievement returns.

    GetUserStat(CSteamID, string, out int)

    Calls the Steamworks ISteamGameServerStats::GetUserStat method.

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

    Passed through to ISteamGameServerStats::GetUserStat.

    string pchName

    Passed through to ISteamGameServerStats::GetUserStat.

    int pData

    Passed through to ISteamGameServerStats::GetUserStat.

    Returns
    Type Description
    bool

    The value ISteamGameServerStats::GetUserStat returns.

    GetUserStat(CSteamID, string, out float)

    Calls the Steamworks ISteamGameServerStats::GetUserStat method.

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

    Passed through to ISteamGameServerStats::GetUserStat.

    string pchName

    Passed through to ISteamGameServerStats::GetUserStat.

    float pData

    Passed through to ISteamGameServerStats::GetUserStat.

    Returns
    Type Description
    bool

    The value ISteamGameServerStats::GetUserStat returns.

    RequestUserStats(CSteamID)

    downloads stats for the user returns a GSStatsReceived_t callback when completed if the user has no stats, GSStatsReceived_t.m_eResult will be set to k_EResultFail these stats will only be auto-updated for clients playing on the server. For other users 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 ISteamGameServerStats::RequestUserStats.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamGameServerStats::RequestUserStats returns.

    RequestUserStatsAsync(CSteamID)

    Async version of RequestUserStats(CSteamID).

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

    Passed through to ISteamGameServerStats::RequestUserStats.

    Returns
    Type Description
    Task<GSStatsReceived_t>

    The GSStatsReceived_t Steam reports once the call completes.

    SetUserAchievement(CSteamID, string)

    Calls the Steamworks ISteamGameServerStats::SetUserAchievement method.

    Declaration
    public static bool SetUserAchievement(CSteamID steamIDUser, string pchName)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamGameServerStats::SetUserAchievement.

    string pchName

    Passed through to ISteamGameServerStats::SetUserAchievement.

    Returns
    Type Description
    bool

    The value ISteamGameServerStats::SetUserAchievement returns.

    SetUserStat(CSteamID, string, int)

    Calls the Steamworks ISteamGameServerStats::SetUserStat method.

    Declaration
    public static bool SetUserStat(CSteamID steamIDUser, string pchName, int nData)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamGameServerStats::SetUserStat.

    string pchName

    Passed through to ISteamGameServerStats::SetUserStat.

    int nData

    Passed through to ISteamGameServerStats::SetUserStat.

    Returns
    Type Description
    bool

    The value ISteamGameServerStats::SetUserStat returns.

    SetUserStat(CSteamID, string, float)

    Calls the Steamworks ISteamGameServerStats::SetUserStat method.

    Declaration
    public static bool SetUserStat(CSteamID steamIDUser, string pchName, float fData)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamGameServerStats::SetUserStat.

    string pchName

    Passed through to ISteamGameServerStats::SetUserStat.

    float fData

    Passed through to ISteamGameServerStats::SetUserStat.

    Returns
    Type Description
    bool

    The value ISteamGameServerStats::SetUserStat returns.

    StoreUserStats(CSteamID)

    Store the current data on the server, will get a GSStatsStored_t callback when set. 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 SteamAPICall_t StoreUserStats(CSteamID steamIDUser)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamGameServerStats::StoreUserStats.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamGameServerStats::StoreUserStats returns.

    StoreUserStatsAsync(CSteamID)

    Async version of StoreUserStats(CSteamID).

    Declaration
    public static Task<GSStatsStored_t> StoreUserStatsAsync(CSteamID steamIDUser)
    Parameters
    Type Name Description
    CSteamID steamIDUser

    Passed through to ISteamGameServerStats::StoreUserStats.

    Returns
    Type Description
    Task<GSStatsStored_t>

    The GSStatsStored_t Steam reports once the call completes.

    UpdateUserAvgRateStat(CSteamID, string, float, double)

    Calls the Steamworks ISteamGameServerStats::UpdateUserAvgRateStat method.

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

    Passed through to ISteamGameServerStats::UpdateUserAvgRateStat.

    string pchName

    Passed through to ISteamGameServerStats::UpdateUserAvgRateStat.

    float flCountThisSession

    Passed through to ISteamGameServerStats::UpdateUserAvgRateStat.

    double dSessionLength

    Passed through to ISteamGameServerStats::UpdateUserAvgRateStat.

    Returns
    Type Description
    bool

    The value ISteamGameServerStats::UpdateUserAvgRateStat returns.

    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)