docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SteamGameServerUtils

    Purpose: interface to user independent utility functions

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

    Methods

    BOverlayNeedsPresent()

    Normally this call is unneeded if your game has a constantly running frame loop that calls the D3D Present API, or OGL SwapBuffers API every frame. However, if you have a game that only refreshes the screen on an event driven basis then that can break the overlay, as it uses your Present/SwapBuffers calls to drive it's internal frame loop and it may also need to Present() to the screen any time an even needing a notification happens or when the overlay is brought up over the game by a user. You can use this API to ask the overlay if it currently need a present in that case, and then you can check for this periodically (roughly 33hz is desirable) and make sure you refresh the screen with Present or SwapBuffers to allow the overlay to do it's work.

    Declaration
    public static bool BOverlayNeedsPresent()
    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::BOverlayNeedsPresent returns.

    CheckFileSignature(string)

    Asynchronous call to check if an executable file has been signed using the public key set on the signing tab of the partner site, for example to refuse to load modified executable files. The result is returned in CheckFileSignature_t. k_ECheckFileSignatureNoSignaturesFoundForThisApp - This app has not been configured on the signing tab of the partner site to enable this function. k_ECheckFileSignatureNoSignaturesFoundForThisFile - This file is not listed on the signing tab for the partner site. k_ECheckFileSignatureFileNotFound - The file does not exist on disk. k_ECheckFileSignatureInvalidSignature - The file exists, and the signing tab has been set for this file, but the file is either not signed or the signature does not match. k_ECheckFileSignatureValidSignature - The file is signed and the signature is valid.

    Declaration
    public static SteamAPICall_t CheckFileSignature(string szFileName)
    Parameters
    Type Name Description
    string szFileName

    Passed through to ISteamGameServerUtils::CheckFileSignature.

    Returns
    Type Description
    SteamAPICall_t

    The value ISteamGameServerUtils::CheckFileSignature returns.

    CheckFileSignatureAsync(string)

    Async version of CheckFileSignature(string).

    Declaration
    public static Task<CheckFileSignature_t> CheckFileSignatureAsync(string szFileName)
    Parameters
    Type Name Description
    string szFileName

    Passed through to ISteamGameServerUtils::CheckFileSignature.

    Returns
    Type Description
    Task<CheckFileSignature_t>

    The CheckFileSignature_t Steam reports once the call completes.

    DismissFloatingGamepadTextInput()

    Dismisses the floating keyboard.

    Declaration
    public static bool DismissFloatingGamepadTextInput()
    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::DismissFloatingGamepadTextInput returns.

    DismissGamepadTextInput()

    Dismisses the full-screen text input dialog.

    Declaration
    public static bool DismissGamepadTextInput()
    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::DismissGamepadTextInput returns.

    FilterText(ETextFilteringContext, CSteamID, string, out string, uint)

    Filters the provided input message and places the filtered result into pchOutFilteredText, using legally required filtering and additional filtering based on the context and user settings eContext is the type of content in the input string sourceSteamID is the Steam ID that is the source of the input string (e.g. the player with the name, or who said the chat text) pchInputText is the input string that should be filtered, which can be ASCII or UTF-8 pchOutFilteredText is where the output will be placed, even if no filtering is performed nByteSizeOutFilteredText is the size (in bytes) of pchOutFilteredText, should be at least strlen(pchInputText)+1 Returns the number of characters (not bytes) filtered

    Declaration
    public static int FilterText(ETextFilteringContext eContext, CSteamID sourceSteamID, string pchInputMessage, out string pchOutFilteredText, uint nByteSizeOutFilteredText)
    Parameters
    Type Name Description
    ETextFilteringContext eContext

    Passed through to ISteamGameServerUtils::FilterText.

    CSteamID sourceSteamID

    Passed through to ISteamGameServerUtils::FilterText.

    string pchInputMessage

    Passed through to ISteamGameServerUtils::FilterText.

    string pchOutFilteredText

    Receives the string ISteamGameServerUtils::FilterText writes.

    uint nByteSizeOutFilteredText

    Passed through to ISteamGameServerUtils::FilterText.

    Returns
    Type Description
    int

    The value ISteamGameServerUtils::FilterText returns.

    GetAPICallFailureReason(SteamAPICall_t)

    Calls the Steamworks ISteamGameServerUtils::GetAPICallFailureReason method.

    Declaration
    public static ESteamAPICallFailure GetAPICallFailureReason(SteamAPICall_t hSteamAPICall)
    Parameters
    Type Name Description
    SteamAPICall_t hSteamAPICall

    Passed through to ISteamGameServerUtils::GetAPICallFailureReason.

    Returns
    Type Description
    ESteamAPICallFailure

    The value ISteamGameServerUtils::GetAPICallFailureReason returns.

    GetAPICallResult(SteamAPICall_t, IntPtr, int, int, out bool)

    Calls the Steamworks ISteamGameServerUtils::GetAPICallResult method.

    Declaration
    public static bool GetAPICallResult(SteamAPICall_t hSteamAPICall, IntPtr pCallback, int cubCallback, int iCallbackExpected, out bool pbFailed)
    Parameters
    Type Name Description
    SteamAPICall_t hSteamAPICall

    Passed through to ISteamGameServerUtils::GetAPICallResult.

    IntPtr pCallback

    Passed through to ISteamGameServerUtils::GetAPICallResult.

    int cubCallback

    Passed through to ISteamGameServerUtils::GetAPICallResult.

    int iCallbackExpected

    Passed through to ISteamGameServerUtils::GetAPICallResult.

    bool pbFailed

    Passed through to ISteamGameServerUtils::GetAPICallResult.

    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::GetAPICallResult returns.

    GetAppID()

    returns the appID of the current process

    Declaration
    public static AppId_t GetAppID()
    Returns
    Type Description
    AppId_t

    The value ISteamGameServerUtils::GetAppID returns.

    GetConnectedUniverse()

    the universe this client is connecting to

    Declaration
    public static EUniverse GetConnectedUniverse()
    Returns
    Type Description
    EUniverse

    The value ISteamGameServerUtils::GetConnectedUniverse returns.

    GetCurrentBatteryPower()

    return the amount of battery power left in the current system in % [0..100], 255 for being on AC power

    Declaration
    public static byte GetCurrentBatteryPower()
    Returns
    Type Description
    byte

    The value ISteamGameServerUtils::GetCurrentBatteryPower returns.

    GetEnteredGamepadTextInput(out string, uint)

    Calls the Steamworks ISteamGameServerUtils::GetEnteredGamepadTextInput method.

    Declaration
    public static bool GetEnteredGamepadTextInput(out string pchText, uint cchText)
    Parameters
    Type Name Description
    string pchText

    Receives the string ISteamGameServerUtils::GetEnteredGamepadTextInput writes.

    uint cchText

    Passed through to ISteamGameServerUtils::GetEnteredGamepadTextInput.

    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::GetEnteredGamepadTextInput returns.

    GetEnteredGamepadTextLength()

    Returns previously entered text & length

    Declaration
    public static uint GetEnteredGamepadTextLength()
    Returns
    Type Description
    uint

    The value ISteamGameServerUtils::GetEnteredGamepadTextLength returns.

    GetIPCCallCount()

    returns the number of IPC calls made since the last time this function was called Used for perf debugging so you can understand how many IPC calls your game makes per frame Every IPC call is at minimum a thread context switch if not a process one so you want to rate control how often you do them.

    Declaration
    public static uint GetIPCCallCount()
    Returns
    Type Description
    uint

    The value ISteamGameServerUtils::GetIPCCallCount returns.

    GetIPCountry()

    returns the 2 digit ISO 3166-1-alpha-2 format country code this client is running in (as looked up via an IP-to-location database) e.g "US" or "UK".

    Declaration
    public static string GetIPCountry()
    Returns
    Type Description
    string

    The value ISteamGameServerUtils::GetIPCountry returns.

    GetIPv6ConnectivityState(ESteamIPv6ConnectivityProtocol)

    Return what we believe your current ipv6 connectivity to "the internet" is on the specified protocol. This does NOT tell you if the Steam client is currently connected to Steam via ipv6.

    Declaration
    public static ESteamIPv6ConnectivityState GetIPv6ConnectivityState(ESteamIPv6ConnectivityProtocol eProtocol)
    Parameters
    Type Name Description
    ESteamIPv6ConnectivityProtocol eProtocol

    Passed through to ISteamGameServerUtils::GetIPv6ConnectivityState.

    Returns
    Type Description
    ESteamIPv6ConnectivityState

    The value ISteamGameServerUtils::GetIPv6ConnectivityState returns.

    GetImageRGBA(int, byte[], int)

    returns true if the image exists, and the buffer was successfully filled out results are returned in RGBA format the destination buffer size should be 4 * height * width * sizeof(char)

    Declaration
    public static bool GetImageRGBA(int iImage, byte[] pubDest, int nDestBufferSize)
    Parameters
    Type Name Description
    int iImage

    Passed through to ISteamGameServerUtils::GetImageRGBA.

    byte[] pubDest

    Passed through to ISteamGameServerUtils::GetImageRGBA.

    int nDestBufferSize

    Passed through to ISteamGameServerUtils::GetImageRGBA.

    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::GetImageRGBA returns.

    GetImageSize(int, out uint, out uint)

    returns true if the image exists, and valid sizes were filled out

    Declaration
    public static bool GetImageSize(int iImage, out uint pnWidth, out uint pnHeight)
    Parameters
    Type Name Description
    int iImage

    Passed through to ISteamGameServerUtils::GetImageSize.

    uint pnWidth

    Passed through to ISteamGameServerUtils::GetImageSize.

    uint pnHeight

    Passed through to ISteamGameServerUtils::GetImageSize.

    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::GetImageSize returns.

    GetSecondsSinceAppActive()

    return the number of seconds since the user

    Declaration
    public static uint GetSecondsSinceAppActive()
    Returns
    Type Description
    uint

    The value ISteamGameServerUtils::GetSecondsSinceAppActive returns.

    GetSecondsSinceComputerActive()

    Calls the Steamworks ISteamGameServerUtils::GetSecondsSinceComputerActive method.

    Declaration
    public static uint GetSecondsSinceComputerActive()
    Returns
    Type Description
    uint

    The value ISteamGameServerUtils::GetSecondsSinceComputerActive returns.

    GetServerRealTime()

    Steam server time. Number of seconds since January 1, 1970, GMT (i.e unix time)

    Declaration
    public static uint GetServerRealTime()
    Returns
    Type Description
    uint

    The value ISteamGameServerUtils::GetServerRealTime returns.

    GetSteamHardwareDefaultConfig()

    Use this method to help choose default game settings (video and other) that you have tuned for specific Steam hardware. It also enables changing your default game settings on future Steam hardware without needing to recompile your game. This method returns an ESteamHardwareDefaultConfig, which has two categories of values:

    • Machine specific values: Map each of these values to a setting configuration tuned for that device.
    • General values (low, medium, high, max): Map these values to one of your game's user selectable setting presets. If your game has less than 4 presets, it is expected that multiple values might map to the same preset. For example, a game with 3 presets might map high and max to the game's 'high' user preset. For games that only have 1 preset and run great on any device, low, medium, high and max might all be mapped to that single preset. By default, this method will return a value corresponding to the device type returned by ISteamUtils::IsRunningOnSteamHardware(), such as returning k_ESteamHardwareDefaultConfigSteamDeck when running on a Steam Deck. It may also return a configuration value for 3rd party hardware that has similar performance characteristics to Steam hardware, such as returning k_ESteamHardwareDefaultConfigSteamDeck when running on a Legion Go S. You can also change what value the Steam Client returns per device through the Steamworks Partner Site. This allows you to customize the default configuration used on future Steam hardware without recompiling your game. For example, if your game runs well on Steam Machine using your 'high' user preset, but was released before that device became available, you could configure this method to return k_ESteamHardwareDefaultConfigHigh when run on those devices. Similarly if your game was released before Steam Frame, you could configure this method to return k_ESteamHardwareDefaultConfigSteamDeck so that when your game is run in 2d mode, it uses your tuned Steam Deck presets. The following example covers a common approach to choosing default settings when running on Steam hardware:
    1. Call GetSteamHardwareDefaultConfig()
    2. If the returned value is for hardware that you have a known configuration for, use a tuned matching configuration
    3. If the returned value is low, medium, high or max, use a matching user preset
    4. If the returned value had no match, fall back to your default setting heuristics
    Declaration
    public static ESteamHardwareDefaultConfig GetSteamHardwareDefaultConfig()
    Returns
    Type Description
    ESteamHardwareDefaultConfig

    The value ISteamGameServerUtils::GetSteamHardwareDefaultConfig returns.

    GetSteamUILanguage()

    returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases

    Declaration
    public static string GetSteamUILanguage()
    Returns
    Type Description
    string

    The value ISteamGameServerUtils::GetSteamUILanguage returns.

    InitFilterText(uint)

    Initializes text filtering, loading dictionaries for the language the game is running in. unFilterOptions are reserved for future use and should be set to 0 Returns false if filtering is unavailable for the game's language, in which case FilterText() will act as a passthrough. Users can customize the text filter behavior in their Steam Account preferences: https://store.steampowered.com/account/preferences#CommunityContentPreferences

    Declaration
    public static bool InitFilterText(uint unFilterOptions = 0)
    Parameters
    Type Name Description
    uint unFilterOptions

    Passed through to ISteamGameServerUtils::InitFilterText.

    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::InitFilterText returns.

    IsAPICallCompleted(SteamAPICall_t, out bool)

    API asynchronous call results can be used directly, but more commonly used via the callback dispatch API (see steam_api.h)

    Declaration
    public static bool IsAPICallCompleted(SteamAPICall_t hSteamAPICall, out bool pbFailed)
    Parameters
    Type Name Description
    SteamAPICall_t hSteamAPICall

    Passed through to ISteamGameServerUtils::IsAPICallCompleted.

    bool pbFailed

    Passed through to ISteamGameServerUtils::IsAPICallCompleted.

    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::IsAPICallCompleted returns.

    IsOverlayEnabled()

    Returns true if the overlay is running & the user can access it. The overlay process could take a few seconds to start & hook the game process, so this function will initially return false while the overlay is loading.

    Declaration
    public static bool IsOverlayEnabled()
    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::IsOverlayEnabled returns.

    IsRunningOnSteamHardware()

    Returns if your process is running on a Steam Deck, Machine, Frame or other hardware. This method is intended to be used for usage analytics, support, diagnostic and other non-functional decisions. If your process needs to make a feature or device capability related decision, the Steamworks SDK exposes a set of other methods. Using one of these alternate methods will enable your game to run correctly on future versions of Steam hardware where this method would return a hardware type not present in old SDK versions. Some alternate methods include:

    • ISteamUtils::GetSteamHardwareDefaultConfig()
    • ISteamUtils::IsSteamInBigPictureMode()
    • ISteamUtils::IsRunningUnderProton()
    • ISteamUtils::IsSteamRunningInVR()
    • ISteamUtils::GetCurrentBatteryPower()
    • ISteamUtils::GetConnectedControllers()
    Declaration
    public static ESteamHardwareType IsRunningOnSteamHardware()
    Returns
    Type Description
    ESteamHardwareType

    The value ISteamGameServerUtils::IsRunningOnSteamHardware returns.

    IsRunningUnderProton()

    Returns true if running under the Proton compatibility layer

    Declaration
    public static bool IsRunningUnderProton()
    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::IsRunningUnderProton returns.

    IsSteamChinaLauncher()

    Returns whether this steam client is a Steam China specific client, vs the global client.

    Declaration
    public static bool IsSteamChinaLauncher()
    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::IsSteamChinaLauncher returns.

    IsSteamInBigPictureMode()

    Returns true if Steam & the Steam Overlay are running in Big Picture mode, where the user is most likely using a gamepad to control the device in a living room like setting or at an increased viewing distance from the TV. Games must be launched through the Steam client to enable the Big Picture overlay. During development, a game can be added as a non-steam game to the developers library to test this feature.

    Declaration
    public static bool IsSteamInBigPictureMode()
    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::IsSteamInBigPictureMode returns.

    IsSteamRunningInVR()

    returns true if Steam itself is running in VR mode

    Declaration
    public static bool IsSteamRunningInVR()
    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::IsSteamRunningInVR returns.

    IsVRHeadsetStreamingEnabled()

    Returns true if the HMD content will be streamed via Steam Remote Play

    Declaration
    public static bool IsVRHeadsetStreamingEnabled()
    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::IsVRHeadsetStreamingEnabled returns.

    SetGameLauncherMode(bool)

    In game launchers that don't have controller support you can call this to have Steam Input translate the controller input into mouse/kb to navigate the launcher

    Declaration
    public static void SetGameLauncherMode(bool bLauncherMode)
    Parameters
    Type Name Description
    bool bLauncherMode

    Passed through to ISteamGameServerUtils::SetGameLauncherMode.

    SetOverlayNotificationInset(int, int)

    Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition.

    Declaration
    public static void SetOverlayNotificationInset(int nHorizontalInset, int nVerticalInset)
    Parameters
    Type Name Description
    int nHorizontalInset

    Passed through to ISteamGameServerUtils::SetOverlayNotificationInset.

    int nVerticalInset

    Passed through to ISteamGameServerUtils::SetOverlayNotificationInset.

    SetOverlayNotificationPosition(ENotificationPosition)

    Sets the position where the overlay instance for the currently calling game should show notifications. This position is per-game and if this function is called from outside of a game context it will do nothing.

    Declaration
    public static void SetOverlayNotificationPosition(ENotificationPosition eNotificationPosition)
    Parameters
    Type Name Description
    ENotificationPosition eNotificationPosition

    Passed through to ISteamGameServerUtils::SetOverlayNotificationPosition.

    SetVRHeadsetStreamingEnabled(bool)

    Set whether the HMD content will be streamed via Steam Remote Play If this is set to true, then the scene in the HMD headset will be streamed, and remote input will not be allowed. If this is set to false, then the application window will be streamed instead, and remote input will be allowed. The default is true unless "VRHeadsetStreaming" "0" is in the extended appinfo for a game. (this is useful for games that have asymmetric multiplayer gameplay)

    Declaration
    public static void SetVRHeadsetStreamingEnabled(bool bEnabled)
    Parameters
    Type Name Description
    bool bEnabled

    Passed through to ISteamGameServerUtils::SetVRHeadsetStreamingEnabled.

    SetWarningMessageHook(SteamAPIWarningMessageHook_t)

    API warning handling 'int' is the severity; 0 for msg, 1 for warning 'const char *' is the text of the message callbacks will occur directly after the API function is called that generated the warning or message

    Declaration
    public static void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction)
    Parameters
    Type Name Description
    SteamAPIWarningMessageHook_t pFunction

    Passed through to ISteamGameServerUtils::SetWarningMessageHook.

    ShowFloatingGamepadTextInput(EFloatingGamepadTextInputMode, int, int, int, int)

    Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game. The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field

    Declaration
    public static bool ShowFloatingGamepadTextInput(EFloatingGamepadTextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight)
    Parameters
    Type Name Description
    EFloatingGamepadTextInputMode eKeyboardMode

    Passed through to ISteamGameServerUtils::ShowFloatingGamepadTextInput.

    int nTextFieldXPosition

    Passed through to ISteamGameServerUtils::ShowFloatingGamepadTextInput.

    int nTextFieldYPosition

    Passed through to ISteamGameServerUtils::ShowFloatingGamepadTextInput.

    int nTextFieldWidth

    Passed through to ISteamGameServerUtils::ShowFloatingGamepadTextInput.

    int nTextFieldHeight

    Passed through to ISteamGameServerUtils::ShowFloatingGamepadTextInput.

    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::ShowFloatingGamepadTextInput returns.

    ShowGamepadTextInput(EGamepadTextInputMode, EGamepadTextInputLineMode, string, uint, string)

    Activates the full-screen text input dialog which takes a initial text string and returns the text the user has typed

    Declaration
    public static bool ShowGamepadTextInput(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, string pchDescription, uint unCharMax, string pchExistingText)
    Parameters
    Type Name Description
    EGamepadTextInputMode eInputMode

    Passed through to ISteamGameServerUtils::ShowGamepadTextInput.

    EGamepadTextInputLineMode eLineInputMode

    Passed through to ISteamGameServerUtils::ShowGamepadTextInput.

    string pchDescription

    Passed through to ISteamGameServerUtils::ShowGamepadTextInput.

    uint unCharMax

    Passed through to ISteamGameServerUtils::ShowGamepadTextInput.

    string pchExistingText

    Passed through to ISteamGameServerUtils::ShowGamepadTextInput.

    Returns
    Type Description
    bool

    The value ISteamGameServerUtils::ShowGamepadTextInput returns.

    StartVRDashboard()

    ask SteamUI to create and render its OpenVR dashboard

    Declaration
    public static void StartVRDashboard()
    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)