Table of Contents

Class SteamLobbyData

Namespace
SteamNetworkLib.Core
Assembly
SteamNetworkLib.dll

Manages Steam lobby data (global key-value storage for the lobby). Provides functionality for getting lobby-wide data that is accessible to all players. Only the lobby host can set and manage the lobby data.

public class SteamLobbyData : IDisposable
Inheritance
SteamLobbyData
Implements
Inherited Members

Constructors

SteamLobbyData(SteamLobbyManager)

Initializes a new instance of the SteamLobbyData class.

public SteamLobbyData(SteamLobbyManager lobbyManager)

Parameters

lobbyManager SteamLobbyManager

The lobby manager instance to use for lobby operations.

Exceptions

ArgumentNullException

Thrown when lobbyManager is null.

Methods

ClearAllData()

Clears all lobby data. Only the lobby host can perform this operation.

public void ClearAllData()

Exceptions

LobbyException

Thrown when not in a lobby or not the lobby host.

Dispose()

Releases all resources used by the SteamLobbyData.

public void Dispose()

GetAllData()

Gets all lobby data as a dictionary.

public Dictionary<string, string> GetAllData()

Returns

Dictionary<string, string>

A dictionary containing all key-value pairs of lobby data, or an empty dictionary if not in a lobby.

GetData(string)

Gets lobby-wide data by key.

public string? GetData(string key)

Parameters

key string

The data key to retrieve.

Returns

string

The data value if found, or null if not found or not in a lobby.

Exceptions

ArgumentException

Thrown when the key is invalid.

GetDataCount()

Gets the number of data entries in the lobby.

public int GetDataCount()

Returns

int

The count of lobby data entries, or 0 if not in a lobby.

GetDataKeys()

Gets a list of all data keys in the lobby.

public List<string> GetDataKeys()

Returns

List<string>

A list of all data keys, or an empty list if not in a lobby.

HasData(string)

Checks whether lobby data exists for the specified key.

public bool HasData(string key)

Parameters

key string

The data key to check.

Returns

bool

True if the key exists and has a non-empty value, false otherwise.

RefreshData()

Refreshes the lobby data cache by reloading all data from Steam servers.

public void RefreshData()

RemoveData(string)

Removes lobby data for the specified key.

public void RemoveData(string key)

Parameters

key string

The data key to remove.

Exceptions

ArgumentException

Thrown when the key is invalid.

LobbyException

Thrown when not in a lobby or the operation fails.

SetData(string, string)

Sets lobby-wide data that is accessible to all players in the lobby.

public void SetData(string key, string value)

Parameters

key string

The data key. Cannot be null, empty, or exceed 255 characters.

value string

The data value to set.

Exceptions

ArgumentException

Thrown when the key is invalid.

LobbyException

Thrown when not in a lobby or the operation fails.

SetDataBatch(Dictionary<string, string>)

Sets multiple lobby data values in a batch operation.

public void SetDataBatch(Dictionary<string, string> data)

Parameters

data Dictionary<string, string>

A dictionary containing key-value pairs to set. Null or empty dictionaries are ignored.

Exceptions

LobbyException

Thrown when not in a lobby or any individual set operation fails.

Events

OnLobbyDataChanged

Occurs when lobby data is changed by any player in the lobby.

public event EventHandler<LobbyDataChangedEventArgs>? OnLobbyDataChanged

Event Type

EventHandler<LobbyDataChangedEventArgs>