docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct CGameID

    An app id, type and mod id packed into 64 bits, per steamclientpublic.h: bits 0-23 app id, 24-31 type, 32-63 mod id. Holds the packed value instead of C++'s bitfield union, so it stays 8 bytes and blittable.

    Implements
    IEquatable<CGameID>
    IComparable<CGameID>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Steamworks.Interop
    Assembly: Unity.Steamworks.Interop.dll
    Syntax
    [Serializable]
    public struct CGameID : IEquatable<CGameID>, IComparable<CGameID>

    Constructors

    CGameID(uint, uint, EGameIDType)

    Packs an app id, mod id and type without validating them; check IsValid().

    Declaration
    public CGameID(uint nAppID, uint nModID, CGameID.EGameIDType nType)
    Parameters
    Type Name Description
    uint nAppID

    The app id; only its low 24 bits are kept.

    uint nModID

    The 32-bit mod id.

    CGameID.EGameIDType nType

    The kind of entity the id identifies.

    CGameID(ulong)

    Creates an id from the packed 64-bit representation.

    Declaration
    public CGameID(ulong ulGameID)
    Parameters
    Type Name Description
    ulong ulGameID

    The packed 64-bit value.

    CGameID(AppId_t)

    Creates an id from an app id alone (type k_EGameIDTypeApp, no mod).

    Declaration
    public CGameID(AppId_t nAppID)
    Parameters
    Type Name Description
    AppId_t nAppID

    The app id; only its low 24 bits are kept.

    Methods

    AppID()

    The app id; for a shortcut, the shortcut's own id, which Steam stores in the mod-id bits.

    Declaration
    public uint AppID()
    Returns
    Type Description
    uint

    Bits 0-23 of the packed value, or bits 32-63 for a shortcut.

    CompareTo(CGameID)

    Orders this id against other by packed value.

    Declaration
    public int CompareTo(CGameID other)
    Parameters
    Type Name Description
    CGameID other

    The id to compare against.

    Returns
    Type Description
    int

    Negative, zero or positive as this id sorts before, with or after other.

    Equals(object)

    True when obj is a CGameID with the same packed value.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare against.

    Returns
    Type Description
    bool

    true when obj is a CGameID holding the same packed value.

    Overrides
    ValueType.Equals(object)

    Equals(CGameID)

    True when this id has the same packed value as other.

    Declaration
    public bool Equals(CGameID other)
    Parameters
    Type Name Description
    CGameID other

    The id to compare against.

    Returns
    Type Description
    bool

    true when the packed values are equal.

    GetHashCode()

    The hash code of the packed 64-bit value.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    The packed value's hash code.

    Overrides
    ValueType.GetHashCode()

    IsMod()

    True when this id identifies a mod.

    Declaration
    public bool IsMod()
    Returns
    Type Description
    bool

    true when the type component is k_EGameIDTypeGameMod.

    IsShortcut()

    True when this id identifies a non-Steam shortcut.

    Declaration
    public bool IsShortcut()
    Returns
    Type Description
    bool

    true when the type component is k_EGameIDTypeShortcut.

    IsSteamApp()

    True when this id identifies a Steam app.

    Declaration
    public bool IsSteamApp()
    Returns
    Type Description
    bool

    true when the type component is k_EGameIDTypeApp.

    IsValid()

    Checks the app id and mod id against the rules for this id's type.

    Declaration
    public bool IsValid()
    Returns
    Type Description
    bool

    true when the id is well-formed for its type; an unknown type is never valid.

    ModID()

    The mod id; a shortcut has none, because its id is what AppID() returns.

    Declaration
    public uint ModID()
    Returns
    Type Description
    uint

    Bits 32-63 of the packed value, or 0 for a shortcut.

    Reset()

    Clears all three components, leaving an invalid id.

    Declaration
    public void Reset()

    Set(ulong)

    Replaces the packed 64-bit representation.

    Declaration
    public void Set(ulong ulGameID)
    Parameters
    Type Name Description
    ulong ulGameID

    The packed 64-bit value to store.

    ToString()

    The packed 64-bit value in decimal.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    The packed value formatted in decimal.

    Overrides
    ValueType.ToString()

    ToUint64()

    The packed 64-bit representation.

    Declaration
    public ulong ToUint64()
    Returns
    Type Description
    ulong

    All three components packed into one 64-bit value.

    Type()

    The type component, which decides how the other two are read.

    Declaration
    public CGameID.EGameIDType Type()
    Returns
    Type Description
    CGameID.EGameIDType

    Bits 24-31 of the packed value.

    Operators

    operator ==(CGameID, CGameID)

    True when both ids have the same packed value.

    Declaration
    public static bool operator ==(CGameID x, CGameID y)
    Parameters
    Type Name Description
    CGameID x

    The first id to compare.

    CGameID y

    The second id to compare.

    Returns
    Type Description
    bool

    true when the packed values are equal.

    explicit operator CGameID(ulong)

    Reinterprets a packed 64-bit value as a CGameID.

    Declaration
    public static explicit operator CGameID(ulong value)
    Parameters
    Type Name Description
    ulong value

    The packed 64-bit value.

    Returns
    Type Description
    CGameID

    A CGameID over value.

    explicit operator ulong(CGameID)

    The id's packed 64-bit value.

    Declaration
    public static explicit operator ulong(CGameID gameID)
    Parameters
    Type Name Description
    CGameID gameID

    The id to unpack.

    Returns
    Type Description
    ulong

    All three components packed into one 64-bit value.

    operator >(CGameID, CGameID)

    Orders ids by their packed value.

    Declaration
    public static bool operator >(CGameID x, CGameID y)
    Parameters
    Type Name Description
    CGameID x

    The id on the left of the operator.

    CGameID y

    The id on the right of the operator.

    Returns
    Type Description
    bool

    true when x has the larger packed value.

    operator !=(CGameID, CGameID)

    True when the ids have different packed values.

    Declaration
    public static bool operator !=(CGameID x, CGameID y)
    Parameters
    Type Name Description
    CGameID x

    The first id to compare.

    CGameID y

    The second id to compare.

    Returns
    Type Description
    bool

    true when the packed values differ.

    operator <(CGameID, CGameID)

    Orders ids by their packed value.

    Declaration
    public static bool operator <(CGameID x, CGameID y)
    Parameters
    Type Name Description
    CGameID x

    The id on the left of the operator.

    CGameID y

    The id on the right of the operator.

    Returns
    Type Description
    bool

    true when x has the smaller packed value.

    Implements

    IEquatable<T>
    IComparable<T>
    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)