Struct CSteamID
A 64-bit Steam id, per steamclientpublic.h: bits 0-31 account id, 32-51 account instance, 52-55 account type, 56-63 universe. Holds the packed value instead of C++'s bitfield union, so it stays 8 bytes and blittable and appears directly in P/Invoke signatures.
Inherited Members
Namespace: Unity.Steamworks.Interop
Assembly: Unity.Steamworks.Interop.dll
Syntax
[Serializable]
public struct CSteamID : IEquatable<CSteamID>, IComparable<CSteamID>
Constructors
CSteamID(uint, uint, EUniverse, EAccountType)
Creates an id from an account id, explicit instance, universe and type.
Declaration
public CSteamID(uint unAccountID, uint unAccountInstance, EUniverse eUniverse, EAccountType eAccountType)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | unAccountID | The 32-bit account id. |
| uint | unAccountInstance | The 20-bit account instance. |
| EUniverse | eUniverse | The universe the account belongs to. |
| EAccountType | eAccountType | The kind of account this id identifies. |
CSteamID(uint, EUniverse, EAccountType)
Creates an id from an account id, universe and type, choosing the instance as Set(uint, EUniverse, EAccountType) does.
Declaration
public CSteamID(uint unAccountID, EUniverse eUniverse, EAccountType eAccountType)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | unAccountID | The 32-bit account id. |
| EUniverse | eUniverse | The universe the account belongs to. |
| EAccountType | eAccountType | The kind of account this id identifies. |
CSteamID(ulong)
Creates an id from the packed 64-bit representation.
Declaration
public CSteamID(ulong ulSteamID)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | ulSteamID | The packed 64-bit value. |
Fields
k_steamIDLanModeGS
The id a client sees for a game server running in LAN mode (sv_lan).
Declaration
public static readonly CSteamID k_steamIDLanModeGS
Field Value
| Type | Description |
|---|---|
| CSteamID |
k_steamIDNil
The generic invalid Steam id (all zero).
Declaration
public static readonly CSteamID k_steamIDNil
Field Value
| Type | Description |
|---|---|
| CSteamID |
k_steamIDNonSteamGS
The id a client sees for a game server that does not use Steam authentication but still supports "Join Game" from the friends list.
Declaration
public static readonly CSteamID k_steamIDNonSteamGS
Field Value
| Type | Description |
|---|---|
| CSteamID |
k_steamIDNotInitYetGS
The id a client sees for a game server that has booted but not yet started logging on to Steam.
Declaration
public static readonly CSteamID k_steamIDNotInitYetGS
Field Value
| Type | Description |
|---|---|
| CSteamID |
k_steamIDOutofDateGS
The id a client sees for a game server too old to report its own Steam id.
Declaration
public static readonly CSteamID k_steamIDOutofDateGS
Field Value
| Type | Description |
|---|---|
| CSteamID |
Methods
BAnonAccount()
Checks whether this is an anonymous (user or game server) id.
Declaration
public bool BAnonAccount()
Returns
| Type | Description |
|---|---|
| bool | true for both anonymous types. |
BAnonGameServerAccount()
Checks whether this is an anonymous game server id.
Declaration
public bool BAnonGameServerAccount()
Returns
| Type | Description |
|---|---|
| bool | true for the anonymous game server type only. |
BAnonUserAccount()
Checks whether this is an anonymous user id (used to create an account or reset a password).
Declaration
public bool BAnonUserAccount()
Returns
| Type | Description |
|---|---|
| bool | true for the anonymous user type only. |
BBlankAnonAccount()
Checks whether this is an anonymous login that Steam will fill in.
Declaration
public bool BBlankAnonAccount()
Returns
| Type | Description |
|---|---|
| bool | true when this is an anonymous account with no account id or instance yet. |
BChatAccount()
Checks whether this is a chat id (chat rooms, lobbies, and so on).
Declaration
public bool BChatAccount()
Returns
| Type | Description |
|---|---|
| bool | true for the chat type. |
BClanAccount()
Checks whether this is a clan id.
Declaration
public bool BClanAccount()
Returns
| Type | Description |
|---|---|
| bool | true for the clan type. |
BConsoleUserAccount()
Checks whether this is a stand-in id for a console (for example, PSN) friend account.
Declaration
public bool BConsoleUserAccount()
Returns
| Type | Description |
|---|---|
| bool | true for the console-user type. |
BContentServerAccount()
Checks whether this is a content server id.
Declaration
public bool BContentServerAccount()
Returns
| Type | Description |
|---|---|
| bool | true for the content server type. |
BGameServerAccount()
Checks whether this is a game server id, persistent or anonymous.
Declaration
public bool BGameServerAccount()
Returns
| Type | Description |
|---|---|
| bool | true for both the persistent and the anonymous game server types. |
BIndividualAccount()
Checks whether this is an individual user id.
Declaration
public bool BIndividualAccount()
Returns
| Type | Description |
|---|---|
| bool | true for the individual and console-user types. |
BPersistentGameServerAccount()
Checks whether this is a persistent (not anonymous) game server id.
Declaration
public bool BPersistentGameServerAccount()
Returns
| Type | Description |
|---|---|
| bool | true for the persistent game server type only. |
Clear()
Clears all fields, leaving an invalid id.
Declaration
public void Clear()
CompareTo(CSteamID)
Orders this id against other by packed value.
Declaration
public int CompareTo(CSteamID other)
Parameters
| Type | Name | Description |
|---|---|---|
| CSteamID | other | The id to compare against. |
Returns
| Type | Description |
|---|---|
| int | Negative, zero or positive as this id sorts before, with or after |
ConvertToUint64()
The packed 64-bit representation.
Declaration
public ulong ConvertToUint64()
Returns
| Type | Description |
|---|---|
| ulong | All four components packed into one 64-bit value. |
CreateBlankAnonLogon(EUniverse)
Makes this an anonymous game server login to be filled in by Steam.
Declaration
public void CreateBlankAnonLogon(EUniverse eUniverse)
Parameters
| Type | Name | Description |
|---|---|---|
| EUniverse | eUniverse | The universe to log the anonymous game server into. |
CreateBlankAnonUserLogon(EUniverse)
Makes this an anonymous user login to be filled in by Steam.
Declaration
public void CreateBlankAnonUserLogon(EUniverse eUniverse)
Parameters
| Type | Name | Description |
|---|---|---|
| EUniverse | eUniverse | The universe to log the anonymous user into. |
Equals(object)
True when obj is a CSteamID 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 |
Overrides
Equals(CSteamID)
True when this id has the same packed value as other.
Declaration
public bool Equals(CSteamID other)
Parameters
| Type | Name | Description |
|---|---|---|
| CSteamID | other | The id to compare against. |
Returns
| Type | Description |
|---|---|
| bool | true when the packed values are equal. |
FullSet(ulong, EUniverse, EAccountType)
Sets the 52-bit identifier (account id and instance) plus universe and type.
Declaration
public void FullSet(ulong ulIdentifier, EUniverse eUniverse, EAccountType eAccountType)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | ulIdentifier | The account id in bits 0-31 and the instance in bits 32-51. |
| EUniverse | eUniverse | The universe the account belongs to. |
| EAccountType | eAccountType | The kind of account this id identifies. |
GetAccountID()
The 32-bit account id component.
Declaration
public AccountID_t GetAccountID()
Returns
| Type | Description |
|---|---|
| AccountID_t | Bits 0-31 of the packed value. |
GetEAccountType()
The account type component.
Declaration
public EAccountType GetEAccountType()
Returns
| Type | Description |
|---|---|
| EAccountType | Bits 52-55 of the packed value. |
GetEUniverse()
The universe component.
Declaration
public EUniverse GetEUniverse()
Returns
| Type | Description |
|---|---|
| EUniverse | Bits 56-63 of the packed value. |
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
GetStaticAccountKey()
A key shared by every instance of a multiseat account: the id with its instance zeroed.
Declaration
public ulong GetStaticAccountKey()
Returns
| Type | Description |
|---|---|
| ulong | The universe, type and account id at their usual bit positions. |
GetUnAccountInstance()
The 20-bit account instance component.
Declaration
public uint GetUnAccountInstance()
Returns
| Type | Description |
|---|---|
| uint | Bits 32-51 of the packed value. |
InstancedSet(uint, uint, EUniverse, EAccountType)
Sets all four components explicitly.
Declaration
public void InstancedSet(uint unAccountID, uint unInstance, EUniverse eUniverse, EAccountType eAccountType)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | unAccountID | The 32-bit account id. |
| uint | unInstance | The 20-bit account instance. |
| EUniverse | eUniverse | The universe the account belongs to. |
| EAccountType | eAccountType | The kind of account this id identifies. |
IsLobby()
Checks whether this is a lobby id.
Declaration
public bool IsLobby()
Returns
| Type | Description |
|---|---|
| bool | true for a chat id whose instance carries the lobby flag. |
IsValid()
Checks that the universe and type are in range and the account fits the type: individual ids need a non-zero account and the default instance, clans a non-zero account and instance 0, game servers a non-zero account.
Declaration
public bool IsValid()
Returns
| Type | Description |
|---|---|
| bool | true when the id is well-formed. |
Set(uint, EUniverse, EAccountType)
Sets the account id, universe and type. The instance becomes 0 for clan and game server ids and the default user instance otherwise.
Declaration
public void Set(uint unAccountID, EUniverse eUniverse, EAccountType eAccountType)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | unAccountID | The 32-bit account id. |
| EUniverse | eUniverse | The universe the account belongs to. |
| EAccountType | eAccountType | The kind of account this id identifies. |
SetAccountID(uint)
Replaces the account id, leaving the other three components alone.
Declaration
public void SetAccountID(uint unAccountID)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | unAccountID | The 32-bit account id to store. |
SetAccountInstance(uint)
Replaces the account instance, leaving the other three components alone.
Declaration
public void SetAccountInstance(uint unInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | unInstance | The 20-bit account instance to store. |
SetEUniverse(EUniverse)
Replaces the universe, leaving the other three components alone.
Declaration
public void SetEUniverse(EUniverse eUniverse)
Parameters
| Type | Name | Description |
|---|---|---|
| EUniverse | eUniverse | The universe to store. |
SetFromUint64(ulong)
Replaces the packed 64-bit representation.
Declaration
public void SetFromUint64(ulong ulSteamID)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | ulSteamID | The packed 64-bit value. |
ToString()
The packed 64-bit value in decimal (the common "steamID64" rendering).
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The packed value formatted in decimal. |
Overrides
Operators
operator ==(CSteamID, CSteamID)
True when both ids have the same packed value.
Declaration
public static bool operator ==(CSteamID x, CSteamID y)
Parameters
| Type | Name | Description |
|---|---|---|
| CSteamID | x | The first id to compare. |
| CSteamID | y | The second id to compare. |
Returns
| Type | Description |
|---|---|
| bool | true when the packed values are equal. |
explicit operator CSteamID(ulong)
Reinterprets a packed 64-bit value as a CSteamID.
Declaration
public static explicit operator CSteamID(ulong value)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | value | The packed 64-bit value. |
Returns
| Type | Description |
|---|---|
| CSteamID | A |
explicit operator ulong(CSteamID)
The id's packed 64-bit value.
Declaration
public static explicit operator ulong(CSteamID steamID)
Parameters
| Type | Name | Description |
|---|---|---|
| CSteamID | steamID | The id to unpack. |
Returns
| Type | Description |
|---|---|
| ulong | All four components packed into one 64-bit value. |
operator >(CSteamID, CSteamID)
Orders ids by their packed value.
Declaration
public static bool operator >(CSteamID x, CSteamID y)
Parameters
| Type | Name | Description |
|---|---|---|
| CSteamID | x | The id on the left of the operator. |
| CSteamID | y | The id on the right of the operator. |
Returns
| Type | Description |
|---|---|
| bool | true when |
operator !=(CSteamID, CSteamID)
True when the ids have different packed values.
Declaration
public static bool operator !=(CSteamID x, CSteamID y)
Parameters
| Type | Name | Description |
|---|---|---|
| CSteamID | x | The first id to compare. |
| CSteamID | y | The second id to compare. |
Returns
| Type | Description |
|---|---|
| bool | true when the packed values differ. |
operator <(CSteamID, CSteamID)
Orders ids by their packed value.
Declaration
public static bool operator <(CSteamID x, CSteamID y)
Parameters
| Type | Name | Description |
|---|---|---|
| CSteamID | x | The id on the left of the operator. |
| CSteamID | y | The id on the right of the operator. |
Returns
| Type | Description |
|---|---|
| bool | true when |