Search Results for

    Show / Hide Table of Contents

    Class KaijuStats

    Handles all achievements, stats, and leaderboards functionality.

    Inheritance
    System.Object
    KaijuStats
    Namespace: KaijuSolutions.MultiplayerEngine
    Syntax
    public static class KaijuStats

    Properties

    HaveGlobalAchievementPercentages

    If we have at least once requested and received global achievement percentages. If this is false, you should call RequestGlobalAchievementPercentages() before any GetAchievementPercent(String) or GetAchievementPercent(UInt32) calls.

    Declaration
    public static bool HaveGlobalAchievementPercentages { get; }
    Property Value
    Type Description
    System.Boolean

    HaveGlobalStats

    If we have at least once requested and received global stats. If this is false, you should call RequestGlobalStats(Int32). If this is false, you should call RequestGlobalStats(Int32) before any GetGlobalStatLongInteger(String), GetGlobalStatDouble(String), GetGlobalStatHistory(String, Double[]), or GetGlobalStatHistory(String, Int64[]) calls.

    Declaration
    public static bool HaveGlobalStats { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    AttachLeaderboardUserGeneratedContent(UInt64, UInt64)

    Attaches a piece of user generated content the current user's entry on a leaderboard. Listen for a OnLeaderboardUserGeneratedContentSet callback to see if it is successful on the Steam servers.

    Declaration
    public static bool AttachLeaderboardUserGeneratedContent(ulong leaderboard, ulong userGeneratedContent)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of leaderboard.

    System.UInt64 userGeneratedContent

    The ID of the user generated content.

    Returns
    Type Description
    System.Boolean

    True if the request was made, false otherwise.

    ClearAchievement(String, Boolean)

    Resets the unlock status of an achievement. This is primarily only ever used for testing, but maybe you want to give your users the option to reset stats.

    Declaration
    public static bool ClearAchievement(string achievement, bool store = true)
    Parameters
    Type Name Description
    System.String achievement

    The achievement to clear.

    System.Boolean store

    If this should store the achievement on the Steam servers. Otherwise, the change is only local, and you will need to call StoreStats() after.

    Returns
    Type Description
    System.Boolean

    True if the achievement was cleared. If this should store on the remote servers, this must also successfully be sent or this will return false.

    ClearAchievement(UInt32, Boolean)

    Resets the unlock status of an achievement. This is primarily only ever used for testing, but maybe you want to give your users the option to reset stats.

    Declaration
    public static bool ClearAchievement(uint index, bool store = true)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    System.Boolean store

    If this should store the achievement on the Steam servers. Otherwise, the change is only local, and you will need to call StoreStats() after.

    Returns
    Type Description
    System.Boolean

    True if the achievement was cleared. If this should store on the remote servers, this must also successfully be sent or this will return false.

    DownloadLeaderboardEntries(UInt64, KaijuLeaderboardRequest, Int32, Int32)

    Fetches a series of leaderboard entries for a specified leaderboard. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntries(ulong leaderboard, KaijuLeaderboardRequest mode = KaijuLeaderboardRequest.Friends, int start = 1, int end = 1)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of the leaderboard.

    KaijuLeaderboardRequest mode

    Define how to handle the start and end values.

    System.Int32 start

    The start index which is handled based on the mode.

    System.Int32 end

    The end index which is handled based on the mode.

    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entries was made.

    DownloadLeaderboardEntriesAbove(UInt64, Int32)

    Helper to download the leaderboard entries above the current user and the user themselves. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntriesAbove(ulong leaderboard, int above)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of the leaderboard.

    System.Int32 above

    The number of entries above return.

    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entries was made.

    DownloadLeaderboardEntriesAround(UInt64, Int32)

    Helper to download the leaderboard entries above and below the current user and the user themselves. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntriesAround(ulong leaderboard, int number)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of the leaderboard.

    System.Int32 number

    The number of entries both above and below to return. For example, passing five will return the five above, ourselves, and five below.

    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entries was made.

    DownloadLeaderboardEntriesAround(UInt64, Int32, Int32)

    Helper to download the leaderboard entries above and below the current user and the user themselves. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntriesAround(ulong leaderboard, int above, int below)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of the leaderboard.

    System.Int32 above

    The number of entries above return.

    System.Int32 below

    The number of entries below to return.

    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entries was made.

    DownloadLeaderboardEntriesBelow(UInt64, Int32)

    Helper to download the leaderboard entries above the current user and the user themselves. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntriesBelow(ulong leaderboard, int below)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of the leaderboard.

    System.Int32 below

    The number of entries below to return.

    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entries was made.

    DownloadLeaderboardEntriesForFriends(UInt64)

    Fetches a series of leaderboard entries for a specified leaderboard and all our friends, including us. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntriesForFriends(ulong leaderboard)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of the leaderboard.

    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entries was made.

    DownloadLeaderboardEntriesForLobby(UInt64)

    Fetches a series of leaderboard entries for a specified leaderboard and all players in the lobby, including us. If we are not in a lobby, this will just have us. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntriesForLobby(ulong leaderboard)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of the leaderboard.

    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entries was made.

    DownloadLeaderboardEntriesForUser(UInt64, UInt64)

    Fetches a series of leaderboard entries for a specified leaderboard and a certain player. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntriesForUser(ulong leaderboard, ulong user)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of the leaderboard.

    System.UInt64 user

    The ID of the player to get.

    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entries was made.

    DownloadLeaderboardEntriesForUsers(UInt64, IList<UInt64>)

    Fetches a series of leaderboard entries for a specified leaderboard and certain players. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntriesForUsers(ulong leaderboard, IList<ulong> ids)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of the leaderboard.

    IList<System.UInt64> ids

    The IDs of the players to get, defaulting to all users in the current lobby if NULL.

    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entries was made.

    DownloadLeaderboardEntriesTop(UInt64, Int32)

    Helper to download the top leaderboard entries. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntriesTop(ulong leaderboard, int number)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The ID of the leaderboard.

    System.Int32 number

    The number of top entries to download.

    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entries was made.

    DownloadLeaderboardEntrySelf(UInt64)

    Helper to download the leaderboard entry for the user. Listen for the OnLeaderboardScoresDownloaded callback to then handle these.

    Declaration
    public static bool DownloadLeaderboardEntrySelf(ulong leaderboard)
    Parameters
    Type Name Description
    System.UInt64 leaderboard
    Returns
    Type Description
    System.Boolean

    If the request to download the leaderboard entry was made.

    FindLeaderboard(String)

    Get the ID of a leaderboard by name. Listen for a OnLeaderboardFindResult callback to get the ID.

    Declaration
    public static bool FindLeaderboard(string leaderboard)
    Parameters
    Type Name Description
    System.String leaderboard

    The name of the leaderboard.

    Returns
    Type Description
    System.Boolean

    True if the request was made, false otherwise.

    FindOrCreateLeaderboard(String, Boolean, KaijuLeaderboardDisplay)

    Get the ID of a leaderboard by name or create one if it does not exist. Listen for a OnLeaderboardFindResult callback to get the ID.

    Declaration
    public static bool FindOrCreateLeaderboard(string leaderboard, bool ascending = true, KaijuLeaderboardDisplay display = KaijuLeaderboardDisplay.Numeric)
    Parameters
    Type Name Description
    System.String leaderboard

    The name of the leaderboard.

    System.Boolean ascending

    If the leaderboard should be created in ascending or descending order.

    KaijuLeaderboardDisplay display

    The type of data this leaderboard is for.

    Returns
    Type Description
    System.Boolean

    True if the request was made, false otherwise.

    GetAchievement(String)

    Gets the unlock status of an achievement.

    Declaration
    public static bool GetAchievement(string achievement)
    Parameters
    Type Name Description
    System.String achievement

    The API name of the achievement.

    Returns
    Type Description
    System.Boolean

    If the achievement is unlocked or not. Will also return false if there was an error retrieving the achievement.

    GetAchievement(UInt32)

    Gets the unlock status of an achievement.

    Declaration
    public static bool GetAchievement(uint index)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    Returns
    Type Description
    System.Boolean

    If the achievement is unlocked or not. Will also return false if there was an error retrieving the achievement.

    GetAchievement(UInt64, String)

    Gets the unlock status of an achievement of a user. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived callback triggered before accessing this.

    Declaration
    public static bool GetAchievement(ulong user, string achievement)
    Parameters
    Type Name Description
    System.UInt64 user

    The user to get the achievement unlock status for.

    System.String achievement

    The API name of the achievement.

    Returns
    Type Description
    System.Boolean

    If the achievement is unlocked or not for the user. Will also return false if there was an error retrieving the achievement.

    GetAchievement(UInt64, String, out DateTime)

    Gets the unlock status of an achievement and the time it was unlocked at for a user. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived callback triggered before accessing this.

    Declaration
    public static bool GetAchievement(ulong user, string achievement, out DateTime time)
    Parameters
    Type Name Description
    System.UInt64 user

    The user to get the achievement unlock status for.

    System.String achievement

    The API name of the achievement.

    DateTime time

    The time the achievement was unlocked at if it has been.

    Returns
    Type Description
    System.Boolean

    If the achievement is unlocked or not for the user. Will also return false if there was an error retrieving the achievement.

    GetAchievement(UInt64, UInt32)

    Gets the unlock status of an achievement of a user. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived callback triggered before accessing this.

    Declaration
    public static bool GetAchievement(ulong user, uint index)
    Parameters
    Type Name Description
    System.UInt64 user

    The user to get the achievement unlock status for.

    System.UInt32 index

    The achievement's index.

    Returns
    Type Description
    System.Boolean

    If the achievement is unlocked or not for the user. Will also return false if there was an error retrieving the achievement.

    GetAchievement(UInt64, UInt32, out DateTime)

    Gets the unlock status of an achievement and the time it was unlocked at for a user. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived callback triggered before accessing this.

    Declaration
    public static bool GetAchievement(ulong user, uint index, out DateTime time)
    Parameters
    Type Name Description
    System.UInt64 user

    The user to get the achievement unlock status for.

    System.UInt32 index

    The achievement's index.

    DateTime time

    The time the achievement was unlocked at if it has been.

    Returns
    Type Description
    System.Boolean

    If the achievement is unlocked or not for the user. Will also return false if there was an error retrieving the achievement.

    GetAchievementAndUnlockTime(String, out DateTime)

    Gets the unlock status of an achievement and the time it was unlocked at.

    Declaration
    public static bool GetAchievementAndUnlockTime(string achievement, out DateTime time)
    Parameters
    Type Name Description
    System.String achievement

    The API name of the achievement.

    DateTime time

    The time the achievement was unlocked at if it has been.

    Returns
    Type Description
    System.Boolean

    If the achievement is unlocked or not. Will also return false if there was an error retrieving the achievement.

    GetAchievementAndUnlockTime(UInt32, out DateTime)

    Gets the unlock status of an achievement and the time it was unlocked at.

    Declaration
    public static bool GetAchievementAndUnlockTime(uint index, out DateTime time)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    DateTime time

    The time the achievement was unlocked at if it has been.

    Returns
    Type Description
    System.Boolean

    If the achievement is unlocked or not. Will also return false if there was an error retrieving the achievement.

    GetAchievementDisplayAttributes(String, out String, out String)

    Get the name, description, and hidden state of an achievement. Ensure the specified achievement exists in app admin on the Steamworks website, and the changes are published.

    Declaration
    public static bool GetAchievementDisplayAttributes(string achievement, out string name, out string description)
    Parameters
    Type Name Description
    System.String achievement

    The API name of the achievement.

    System.String name

    The display name of the achievement.

    System.String description

    The description of the achievement.

    Returns
    Type Description
    System.Boolean

    True if the achievement is hidden, false if it is not or there was an error.

    GetAchievementDisplayAttributes(UInt32, out String, out String)

    Get the name, description, and hidden state of an achievement. Ensure the specified achievement exists in app admin on the Steamworks website, and the changes are published.

    Declaration
    public static bool GetAchievementDisplayAttributes(uint index, out string name, out string description)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    System.String name

    The display name of the achievement.

    System.String description

    The description of the achievement.

    Returns
    Type Description
    System.Boolean

    True if the achievement is hidden, false if it is not or there was an error.

    GetAchievementDisplayDescription(String)

    Get the description for an achievement. Ensure the specified achievement exists in app admin on the Steamworks website, and the changes are published.

    Declaration
    public static string GetAchievementDisplayDescription(string achievement)
    Parameters
    Type Name Description
    System.String achievement

    The API name of the achievement.

    Returns
    Type Description
    System.String

    The description or an empty string if there was an error.

    GetAchievementDisplayDescription(UInt32)

    Get the description for an achievement. Ensure the specified achievement exists in app admin on the Steamworks website, and the changes are published.

    Declaration
    public static string GetAchievementDisplayDescription(uint index)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    Returns
    Type Description
    System.String

    The description or an empty string if there was an error.

    GetAchievementDisplayHidden(String)

    Get if an achievement is hidden. Ensure the specified achievement exists in app admin on the Steamworks website, and the changes are published.

    Declaration
    public static bool GetAchievementDisplayHidden(string achievement)
    Parameters
    Type Name Description
    System.String achievement

    The API name of the achievement.

    Returns
    Type Description
    System.Boolean

    True if the achievement is hidden, false if it is not or there was an error.

    GetAchievementDisplayHidden(UInt32)

    Get if an achievement is hidden. Ensure the specified achievement exists in app admin on the Steamworks website, and the changes are published.

    Declaration
    public static bool GetAchievementDisplayHidden(uint index)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    Returns
    Type Description
    System.Boolean

    True if the achievement is hidden, false if it is not or there was an error.

    GetAchievementDisplayName(String)

    Get the display name for an achievement. Ensure the specified achievement exists in app admin on the Steamworks website, and the changes are published.

    Declaration
    public static string GetAchievementDisplayName(string achievement)
    Parameters
    Type Name Description
    System.String achievement

    The API name of the achievement.

    Returns
    Type Description
    System.String

    The display name or an empty string if there was an error.

    GetAchievementDisplayName(UInt32)

    Get the display name for an achievement. Ensure the specified achievement exists in app admin on the Steamworks website, and the changes are published.

    Declaration
    public static string GetAchievementDisplayName(uint index)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    Returns
    Type Description
    System.String

    The display name or an empty string if there was an error.

    GetAchievementIcon(String, ref Texture2D)

    Get an icon for an achievement. If this fails, it may simply not be locally cached yet, in which case listen for OnUserAchievementIconFetched.

    Declaration
    public static bool GetAchievementIcon(string achievement, ref Texture2D icon)
    Parameters
    Type Name Description
    System.String achievement

    The API name of the achievement.

    Texture2D icon

    Where to store the icon.

    Returns
    Type Description
    System.Boolean

    True if the icon is already stored locally and loaded into the texture, false otherwise. Note that unlike user icons, Steam does not provide a way to differentiate if there is no icon or if we simply do not have one yet.

    GetAchievementIcon(UInt32, ref Texture2D)

    Get an icon for an achievement. If this fails, it may simply not be locally cached yet, in which case listen for OnUserAchievementIconFetched.

    Declaration
    public static bool GetAchievementIcon(uint index, ref Texture2D icon)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    Texture2D icon

    Where to store the icon.

    Returns
    Type Description
    System.Boolean

    True if the icon is already stored locally and loaded into the texture, false otherwise. Note that unlike user icons, Steam does not provide a way to differentiate if there is no icon or if we simply do not have one yet.

    GetAchievementName(UInt32)

    Get the achievement API name based on an index from GetNumAchievements(). A OnUserStatsReceived callback must have successfully returned prior.

    Declaration
    public static string GetAchievementName(uint index)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    Returns
    Type Description
    System.String

    The API name of the achievement, or an empty string if it does not exist.

    GetAchievementNames()

    Get all achievement API names. A OnUserStatsReceived callback must have successfully returned prior.

    Declaration
    public static string[] GetAchievementNames()
    Returns
    Type Description
    System.String[]

    The API names of the achievements, or an empty array if none exist or there was an error.

    GetAchievementPercent(String)

    Gets the percentage of users who have unlocked an achievement. Must have first called RequestGlobalAchievementPercentages() and it must have successfully triggered a OnGlobalAchievementPercentagesReady.

    Declaration
    public static float GetAchievementPercent(string achievement)
    Parameters
    Type Name Description
    System.String achievement

    The API name of the achievement.

    Returns
    Type Description
    System.Single

    The achievement completed percentage from zero to a hundred, or zero if it could not be retrieved.

    GetAchievementPercent(UInt32)

    Gets the percentage of users who have unlocked an achievement. Must have first called RequestGlobalAchievementPercentages() and it must have successfully triggered a OnGlobalAchievementPercentagesReady.

    Declaration
    public static float GetAchievementPercent(uint index)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    Returns
    Type Description
    System.Single

    The achievement completed percentage from zero to a hundred, or zero if it could not be retrieved.

    GetGlobalStatDouble(String)

    Get a global double stat. RequestGlobalStats(Int32) must be called first. If this is a long integer stat as set in Steamworks, it will cast it to a double.

    Declaration
    public static double GetGlobalStatDouble(string stat)
    Parameters
    Type Name Description
    System.String stat

    The API name of the stat.

    Returns
    Type Description
    System.Double

    The global stat or zero if there was an issue.

    GetGlobalStatHistory(String, Double[])

    Get the history of a global double stat. RequestGlobalStats(Int32) must be called first.

    Declaration
    public static int GetGlobalStatHistory(string stat, double[] history)
    Parameters
    Type Name Description
    System.String stat

    The API name of the stat.

    System.Double[] history

    The array to store history values into, which will represent values from today into the past for the given size of this array.

    Returns
    Type Description
    System.Int32

    The number of entries actually written into the history array, being between zero and the length of the array inclusively.

    GetGlobalStatHistory(String, Int64[])

    Get the history of a global integer stat. RequestGlobalStats(Int32) must be called first.

    Declaration
    public static int GetGlobalStatHistory(string stat, long[] history)
    Parameters
    Type Name Description
    System.String stat

    The API name of the stat.

    System.Int64[] history

    The array to store history values into, which will represent values from today into the past for the given size of this array.

    Returns
    Type Description
    System.Int32

    The number of entries actually written into the history array, being between zero and the length of the array inclusively.

    GetGlobalStatLongInteger(String)

    Get a global long integer stat. RequestGlobalStats(Int32) must be called first. If this is a double stat as set in Steamworks, it will cast it to a long integer.

    Declaration
    public static long GetGlobalStatLongInteger(string stat)
    Parameters
    Type Name Description
    System.String stat

    The API name of the stat.

    Returns
    Type Description
    System.Int64

    The global stat or zero if there was an issue.

    GetLeaderboardDisplayType(UInt64)

    Get the type that a leaderboard is.

    Declaration
    public static KaijuLeaderboardDisplay GetLeaderboardDisplayType(ulong leaderboard)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The leaderboard to get the type of.

    Returns
    Type Description
    KaijuLeaderboardDisplay

    The type of leaderboard. If there is an error, it will return as a standard numeric leaderboard.

    GetLeaderboardEntryCount(UInt64)

    Get the number of entries in a leaderboard.

    Declaration
    public static int GetLeaderboardEntryCount(ulong leaderboard)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The leaderboard to get the number of entries for.

    Returns
    Type Description
    System.Int32

    The number of entries in the leaderboard or zero if there is an error.

    GetLeaderboardName(UInt64)

    Get the name of a leaderboard.

    Declaration
    public static string GetLeaderboardName(ulong leaderboard)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The leaderboard to get the name of.

    Returns
    Type Description
    System.String

    The name of the leaderboard or an empty string if there is an error.

    GetLeaderboardSortAscending(UInt64)

    Get if a leaderboard is sorted in ascending order.

    Declaration
    public static bool GetLeaderboardSortAscending(ulong leaderboard)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The leaderboard to get the sorting of.

    Returns
    Type Description
    System.Boolean

    True if the leaderboard is sorted in ascending order, false if in descending order. Will default to ascending order if there is an error.

    GetMostAchievedAchievementsInfo(out List<String>, out List<Single>, out List<Boolean>)

    Get information about the most achieved achievements which will be output across the lists. RequestGlobalAchievementPercentages() must be called first and OnGlobalAchievementPercentagesReady must have been triggered before calling this.

    Declaration
    public static bool GetMostAchievedAchievementsInfo(out List<string> achievements, out List<float> percentages, out List<bool> achieved)
    Parameters
    Type Name Description
    List<System.String> achievements

    The API names of the achievements.

    List<System.Single> percentages

    The percentages of players which have achieved said achievement.

    List<System.Boolean> achieved

    If the local player has achieved said achievement.

    Returns
    Type Description
    System.Boolean

    True if at least one achievement was returned, false if there was an error or the app has no most achieved achievements.

    GetNumAchievements()

    Get the total number of achievements in the game. A OnUserStatsReceived callback must have successfully returned prior.

    Declaration
    public static uint GetNumAchievements()
    Returns
    Type Description
    System.UInt32

    The number of achievements in the game.

    GetNumberOfCurrentPlayers()

    Starts the call to get the total number of players currently player this game, both in online and invisible modes. Listen for an OnNumberOfCurrentPlayers callback to get the result.

    Declaration
    public static bool GetNumberOfCurrentPlayers()
    Returns
    Type Description
    System.Boolean

    If the call was successfully made or not.

    GetNumberOfCurrentPlayersBindable()

    Starts the call to get the total number of players currently player this game, both in online and invisible modes. Listen for an OnNumberOfCurrentPlayers callback to get the result.

    Declaration
    public static void GetNumberOfCurrentPlayersBindable()

    GetStatFloat(String)

    Get a float stat for us. If this is an integer stat as set in Steamworks, it will cast it to a float.

    Declaration
    public static float GetStatFloat(string stat)
    Parameters
    Type Name Description
    System.String stat

    The API name of the stat.

    Returns
    Type Description
    System.Single

    The value of the stat. Will default to zero if there is an error getting the stat.

    GetStatFloat(UInt64, String, Single)

    Get a float stat for a user. If this is an integer stat as set in Steamworks, it will cast it to a float. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived callback triggered before accessing this.

    Declaration
    public static float GetStatFloat(ulong user, string stat, float fallback = 0F)
    Parameters
    Type Name Description
    System.UInt64 user

    The user to get the achievement unlock status for.

    System.String stat

    The API name of the stat.

    System.Single fallback

    The value to return if there is an error getting the achievement.

    Returns
    Type Description
    System.Single

    The value of the stat for the user or the fallback value if there is an error.

    GetStatInteger(String)

    Get an integer stat for us. If this is a float stat as set in Steamworks, it will cast it to an integer.

    Declaration
    public static int GetStatInteger(string stat)
    Parameters
    Type Name Description
    System.String stat

    The API name of the stat.

    Returns
    Type Description
    System.Int32

    The value of the stat. Will default to zero if there is an error getting the stat.

    GetStatInteger(UInt64, String, Int32)

    Get an integer stat for a user. If this is a float stat as set in Steamworks, it will cast it to an integer. You must have called RequestStats(UInt64) for this user and have their OnUserStatsReceived callback triggered before accessing this.

    Declaration
    public static int GetStatInteger(ulong user, string stat, int fallback = 0)
    Parameters
    Type Name Description
    System.UInt64 user

    The user to get the achievement unlock status for.

    System.String stat

    The API name of the stat.

    System.Int32 fallback

    The value to return if there is an error getting the achievement.

    Returns
    Type Description
    System.Int32

    The value of the stat for the user or the fallback value if there is an error.

    IndicateAchievementProgress(String, UInt32, UInt32, Boolean)

    Shows the user a pop-up notification with the current progress of an achievement.

    Declaration
    public static bool IndicateAchievementProgress(string achievement, uint current, uint max, bool store = false)
    Parameters
    Type Name Description
    System.String achievement

    The API name of the achievement.

    System.UInt32 current

    The current progress. If this is greater than or equal to the max value, the achievement will be unlocked. Note in this case, stats are stored to the remote server always, as this is the only way to trigger the popup.

    System.UInt32 max

    The max value to unlock the achievement. If this is less than or equal to the current value, the achievement will be unlocked. Note in this case, stats are stored to the remote server always, as this is the only way to trigger the popup.

    System.Boolean store

    If this should store the achievement on the Steam servers. Otherwise, the change is only local, and you will need to call StoreStats() after.

    Returns
    Type Description
    System.Boolean

    True if the achievement progress was displayed. If this should store on the remote servers, this must also successfully be sent or this will return false.

    IndicateAchievementProgress(UInt32, UInt32, UInt32, Boolean)

    Shows the user a pop-up notification with the current progress of an achievement.

    Declaration
    public static bool IndicateAchievementProgress(uint index, uint current, uint max, bool store = false)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    System.UInt32 current

    The current progress. If this is greater than or equal to the max value, the achievement will be unlocked. Note in this case, the achievement is only displayed if it is set to store as well.

    System.UInt32 max

    The max value to unlock the achievement. If this is less than or equal to the current value, the achievement will be unlocked. Note in this case, the achievement is only displayed if it is set to store as well.

    System.Boolean store

    If this should store the achievement on the Steam servers. Otherwise, the change is only local, and you will need to call StoreStats() after.

    Returns
    Type Description
    System.Boolean

    True if the achievement progress was displayed. If this should store on the remote servers, this must also successfully be sent or this will return false.

    RequestFriendsStats()

    Request the stats for all of our friends. Listen for OnUserStatsReceived callbacks to get the results.

    Declaration
    public static bool RequestFriendsStats()
    Returns
    Type Description
    System.Boolean

    True if at least one user's stats was requested successfully, false otherwise.

    RequestFriendsStatsBindable()

    Request the stats for all of our friends. Listen for OnUserStatsReceived callbacks to get the results.

    Declaration
    public static void RequestFriendsStatsBindable()

    RequestGlobalAchievementPercentages()

    Request the global achievements. Listen for a OnGlobalAchievementPercentagesReady callback to get the result.

    Declaration
    public static bool RequestGlobalAchievementPercentages()
    Returns
    Type Description
    System.Boolean

    True if the request was made, false otherwise.

    RequestGlobalAchievementPercentagesBindable()

    Request the global achievements. Listen for a OnGlobalAchievementPercentagesReady callback to get the result.

    Declaration
    public static void RequestGlobalAchievementPercentagesBindable()

    RequestGlobalStats(Int32)

    Request the global stats. Listen for a OnGlobalStatsReceived callback to get the result.

    Declaration
    public static bool RequestGlobalStats(int days = 60)
    Parameters
    Type Name Description
    System.Int32 days

    How many days of day-by-day history to retrieve in addition to the overall totals. The limit is 60.

    Returns
    Type Description
    System.Boolean

    True if the request was made, false otherwise.

    RequestLobbyStats()

    Request the stats for all users in our lobby. This will automatically ignore us, as we already have our own stats. Listen for OnUserStatsReceived callbacks to get the results.

    Declaration
    public static bool RequestLobbyStats()
    Returns
    Type Description
    System.Boolean

    True if at least one user's stats was requested successfully, false otherwise.

    RequestLobbyStatsBindable()

    Request the stats for all users in our lobby. Listen for OnUserStatsReceived callbacks to get the results.

    Declaration
    public static void RequestLobbyStatsBindable()

    RequestStats(UInt64)

    Request the stats for a user. Listen for a OnUserStatsReceived callback to get the result.

    Declaration
    public static bool RequestStats(ulong user)
    Parameters
    Type Name Description
    System.UInt64 user

    The user to request the stats for.

    Returns
    Type Description
    System.Boolean

    True if the request was made, false otherwise.

    RequestUsersStats(IEnumerable<UInt64>)

    Request the stats for a list of users. This will automatically ignore us, as we already have our own stats. Listen for OnUserStatsReceived callbacks to get the results.

    Declaration
    public static bool RequestUsersStats(IEnumerable<ulong> users)
    Parameters
    Type Name Description
    IEnumerable<System.UInt64> users
    Returns
    Type Description
    System.Boolean

    True if at least one user's stats was requested successfully, false otherwise.

    ResetAllStats(Boolean)

    Reset all stats and optionally achievements.

    Declaration
    public static bool ResetAllStats(bool achievements = false)
    Parameters
    Type Name Description
    System.Boolean achievements

    If achievements should be reset as well.

    Returns
    Type Description
    System.Boolean

    True if the stats and optionally achievements were reset and a request for updated information was sent to the server.

    ResetAllStatsAndAchievementsBindable()

    Reset all stats and achievements.

    Declaration
    public static void ResetAllStatsAndAchievementsBindable()

    ResetAllStatsBindable()

    Reset all stats achievements.

    Declaration
    public static void ResetAllStatsBindable()

    SetAchievement(String, Boolean)

    Set an achievement as being unlocked.

    Declaration
    public static bool SetAchievement(string achievement, bool store = true)
    Parameters
    Type Name Description
    System.String achievement

    The API name of the achievement.

    System.Boolean store

    If this should store the achievement on the Steam servers. Otherwise, the change is only local, and you will need to call StoreStats() after.

    Returns
    Type Description
    System.Boolean

    True if the achievement was unlocked. If this should store on the remote servers, this must also successfully be sent or this will return false.

    SetAchievement(UInt32, Boolean)

    Set an achievement as being unlocked.

    Declaration
    public static bool SetAchievement(uint index, bool store = true)
    Parameters
    Type Name Description
    System.UInt32 index

    The achievement's index.

    System.Boolean store

    If this should store the achievement on the Steam servers. Otherwise, the change is only local, and you will need to call StoreStats() after.

    Returns
    Type Description
    System.Boolean

    True if the achievement was unlocked. If this should store on the remote servers, this must also successfully be sent or this will return false.

    SetStat(String, Int32, Boolean)

    Set a stat to an integer value. If the stat is a float type, it will still be set.

    Declaration
    public static bool SetStat(string stat, int value, bool store = false)
    Parameters
    Type Name Description
    System.String stat

    The API name of the stat.

    System.Int32 value

    The value of the stat to set.

    System.Boolean store

    If this should store the achievement on the Steam servers. Otherwise, the change is only local, and you will need to call StoreStats() after.

    Returns
    Type Description
    System.Boolean

    True if the stat was updated. If this should store on the remote servers, this must also successfully be sent or this will return false.

    SetStat(String, Single, Boolean)

    Set a stat to a float value. If the stat is an integer type, it will still be set.

    Declaration
    public static bool SetStat(string stat, float value, bool store = false)
    Parameters
    Type Name Description
    System.String stat

    The API name of the stat.

    System.Single value

    The value of the stat to set.

    System.Boolean store

    If this should store the achievement on the Steam servers. Otherwise, the change is only local, and you will need to call StoreStats() after.

    Returns
    Type Description
    System.Boolean

    True if the stat was updated. If this should store on the remote servers, this must also successfully be sent or this will return false.

    StoreStats()

    Send the changed stats and achievements data to the server for permanent storage. Listen for OnUserStatsStored and OnUserAchievementStored callbacks to ensure they were successfully stored. Note that this is called once when the application quits to sync your stats.

    Declaration
    public static bool StoreStats()
    Returns
    Type Description
    System.Boolean

    If stats and achievements were sent to the server.

    StoreStatsBindable()

    Send the changed stats and achievements data to the server for permanent storage. Listen for OnUserStatsStored and OnUserAchievementStored callbacks to ensure they were successfully stored. Note that this is called once when the application quits to sync your stats.

    Declaration
    public static void StoreStatsBindable()

    UpdateAverageRateStat(String, Single, Double, Boolean)

    Update an average rate stat.

    Declaration
    public static bool UpdateAverageRateStat(string stat, float value, double time = 0, bool store = false)
    Parameters
    Type Name Description
    System.String stat

    The API name of the stat.

    System.Single value

    The value accumulation since the last call to this function.

    System.Double time

    The amount of time since the last call to this function. What the unit of time is up for you to decide and handle.

    System.Boolean store

    If this should store the achievement on the Steam servers. Otherwise, the change is only local, and you will need to call StoreStats() after.

    Returns
    Type Description
    System.Boolean

    True if the stat was updated. If this should store on the remote servers, this must also successfully be sent or this will return false.

    UpdateLeaderboardScore(UInt64, Int32, Boolean, Int32[])

    Upload our score for a leaderboard. Listen for an OnLeaderboardScoreUploaded callback to know if this was successful.

    Declaration
    public static bool UpdateLeaderboardScore(ulong leaderboard, int score, bool keepBest = true, int[] details = null)
    Parameters
    Type Name Description
    System.UInt64 leaderboard

    The leaderboard.

    System.Int32 score

    The score to set.

    System.Boolean keepBest

    If we currently have a better score on the leaderboard, this being true will keep it. Otherwise, it will force overwrite it.

    System.Int32[] details

    Any additional details to store, with up to 64 being allowed.

    Returns
    Type Description
    System.Boolean

    If the request was successfully made.

    Events

    OnGlobalAchievementPercentagesReady

    Global achievement percentages being ready callback.

    Declaration
    public static event KaijuStats.SuccessIdEventHandler OnGlobalAchievementPercentagesReady
    Event Type
    Type Description
    KaijuStats.SuccessIdEventHandler

    OnGlobalStatsReceived

    Global stats being received callback.

    Declaration
    public static event KaijuStats.SuccessIdEventHandler OnGlobalStatsReceived
    Event Type
    Type Description
    KaijuStats.SuccessIdEventHandler

    OnLeaderboardFindResult

    Leaderboard finding result callback.

    Declaration
    public static event KaijuStats.LeaderboardFindHandler OnLeaderboardFindResult
    Event Type
    Type Description
    KaijuStats.LeaderboardFindHandler

    OnLeaderboardScoresDownloaded

    Callback for scores being downloaded from a leaderboard.

    Declaration
    public static event KaijuStats.LeaderboardDownloadHandler OnLeaderboardScoresDownloaded
    Event Type
    Type Description
    KaijuStats.LeaderboardDownloadHandler

    OnLeaderboardScoreUploaded

    Callback for scores being uploaded to a leaderboard.

    Declaration
    public static event KaijuStats.LeaderboardScoreUploadedHandler OnLeaderboardScoreUploaded
    Event Type
    Type Description
    KaijuStats.LeaderboardScoreUploadedHandler

    OnLeaderboardUserGeneratedContentSet

    Callback for seeing if user generated content has been attached to a leaderboard entry.

    Declaration
    public static event KaijuStats.SuccessIdEventHandler OnLeaderboardUserGeneratedContentSet
    Event Type
    Type Description
    KaijuStats.SuccessIdEventHandler

    OnNumberOfCurrentPlayers

    Callback for the number of current players for the game.

    Declaration
    public static event KaijuStats.NumberPlayersHandler OnNumberOfCurrentPlayers
    Event Type
    Type Description
    KaijuStats.NumberPlayersHandler

    OnUserAchievementIconFetched

    Callback for getting the icon of an achievement.

    Declaration
    public static event KaijuStats.UserAchievementIconFetchedHandler OnUserAchievementIconFetched
    Event Type
    Type Description
    KaijuStats.UserAchievementIconFetchedHandler

    OnUserAchievementStored

    Callback for storing an achievement for our current player.

    Declaration
    public static event KaijuStats.UserAchievementStoredHandler OnUserAchievementStored
    Event Type
    Type Description
    KaijuStats.UserAchievementStoredHandler

    OnUserStatsReceived

    Callback for receiving the stats of a player.

    Declaration
    public static event KaijuStats.UserStatsReceivedHandler OnUserStatsReceived
    Event Type
    Type Description
    KaijuStats.UserStatsReceivedHandler

    OnUserStatsStored

    Callback for storing our stats.

    Declaration
    public static event KaijuStats.UserStatsStoredHandler OnUserStatsStored
    Event Type
    Type Description
    KaijuStats.UserStatsStoredHandler

    OnUserStatsUnloaded

    Callback for a player's stats being unloaded.

    Declaration
    public static event KaijuMultiplayerManager.IdEventHandler OnUserStatsUnloaded
    Event Type
    Type Description
    KaijuMultiplayerManager.IdEventHandler
    In This Article
    Back to top © 2025 Kaiju Solutions Inc.