Skip to main content
This document provides a detailed reference for the public properties and methods of the PlayFlowLobbyManagerV2 class.

Properties

PlayFlowLobbyManagerV2
required
Singleton instance of the Lobby Manager. Access all lobby functionality through this.
bool
required
Returns true if the manager has been successfully initialized.
Lobby
required
Gets the full data for the lobby the player is currently in. Returns null if not in a lobby.
string
required
Gets the unique ID of the current player, as provided during initialization.
LobbyState
required
Gets the current state of the lobby session (e.g., Disconnected, InLobby).
PlayFlowEvents
required
Provides access to all lobby-related UnityEvents (e.g., OnLobbyJoined, OnPlayerLeft).
List<Lobby>
required
A cached list of all currently available public lobbies. This list is updated automatically if auto-refresh is enabled.
bool
required
A quick check to see if the player is currently in a lobby.
bool
required
Returns true if the current player is the host of the lobby they are in.
string
required
Gets the invite code for the current private lobby. Returns null if not in a private lobby.

Methods

Initializes the lobby manager. This must be called before any other lobby operations.
string
required
A unique identifier for the local player.
Action
An optional callback that is invoked when initialization is successful.
Creates a new lobby. There are two overloads for this method.Pass forceFresh: true to replace any lobby the local player currently hosts in this config — the backend deletes the old lobby (stopping its game server best-effort) before creating the new one. Intended for reconnect / “start a fresh session” flows, where the host may still own a stale lobby from a previous run. It’s a no-op when the player has no prior lobby.Simple:
string
required
The public name of the lobby.
int
The maximum number of players (1–100). The SDK sends 4 when omitted; if you call the API directly and omit this field, the server default is 2.
bool
If true, the lobby will not appear in public searches.
bool
If true, delete any lobby the local player already hosts before creating a new one. Defaults to false.
Action<Lobby>
Callback invoked with the created lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Detailed:
string
required
The public name of the lobby.
int
required
The maximum number of players that can join.
bool
required
If true, the lobby will not appear in public searches.
bool
required
If true, players can join even after the match has started.
string
required
The server region for the lobby (e.g., “us-west”).
Dictionary<string, object>
required
A dictionary of custom game-specific settings.
bool
If true, delete any lobby the local player already hosts before creating a new one. Defaults to false.
Action<Lobby>
Callback invoked with the created lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Shorthand for CreateLobby(..., forceFresh: true). The backend first deletes any lobby this player already hosts (stopping its game server best-effort), then creates a brand-new lobby atomically — replacing the old “TryReconnect → DeleteLobby → CreateLobby” dance with a single call.
string
required
The public name of the lobby.
int
The maximum number of players (1–100). The SDK sends 4 when omitted; the raw API default is 2.
bool
If true, the lobby will not appear in public searches.
Action<Lobby>
Callback invoked with the created lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Joins an existing lobby using its unique ID.
string
required
The unique ID (UUID) of the lobby to join.
Action<Lobby>
Callback invoked with the joined lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Joins an existing private lobby using its invite code.
string
required
The invite code of the lobby to join.
Action<Lobby>
Callback invoked with the joined lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Fetches the list of public lobbies in the project. Results are also cached on the AvailableLobbies property.
Action<List<Lobby>>
required
Callback invoked with the list of public lobbies.
Action<string>
Callback invoked with an error message on failure.
Leaves the lobby the player is currently in.
Action
Callback invoked on successfully leaving the lobby.
Action<string>
Callback invoked with an error message on failure.
Updates the local player’s custom state data within the lobby. This is useful for synchronizing data like character selection or ready status.
Dictionary<string, object>
required
A dictionary representing the player’s custom data.
Action<Lobby>
Callback invoked with the updated lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Kept for backward compatibility. In V3, only the target player can update their own state — if targetPlayerId isn’t the local player this call routes to UpdatePlayerState() and logs a warning. For team/role assignment, have each player set their own team via UpdatePlayerState() or push assignments through UpdateLobbySettings() (host-owned).
string
required
The unique ID of the player whose state you want to update. Must equal the local player ID.
Dictionary<string, object>
required
A dictionary representing the new data for the target player.
Action<Lobby>
Callback invoked with the updated lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Kicks a player from the lobby. This can only be called by the host.
string
required
The unique ID of the player to remove from the lobby.
Action<Lobby>
Callback invoked with the updated lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Host-only. Updates lobby metadata and settings. Pass only the fields you want to change — unspecified fields are left untouched. Cannot be called while the lobby is in_game.
string
New lobby name (1–100 characters).
int?
New max player count (1–100).
bool?
Toggle public/private listing.
bool?
Allow players to join after the match starts.
string
Region for the next game server (e.g. "us-west").
Dictionary<string, object>
Replace the custom settings blob.
Action<Lobby>
Callback invoked with the updated lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Invite codes can’t be toggled per-lobby at runtime. Whether a lobby type issues invite codes is controlled by its inviteCodeConfig in Project Settings; every lobby of a type that has it enabled gets a code automatically.
Convenience shortcut for UpdateLobby(customSettings: newSettings). Host-only. Use this when you only need to update the customSettings dictionary.
Dictionary<string, object>
required
New custom settings dictionary (replaces the existing one).
Action<Lobby>
Callback invoked with the updated lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Host-only. Deletes the current lobby for every player. All members are kicked and the lobby stops appearing in public searches.
Action
Callback invoked once the lobby has been deleted.
Action<string>
Callback invoked with an error message on failure.
V3 does not support explicit host transfer. Calling this method logs a warning and invokes onError. When the current host leaves, the server promotes a new host automatically — no manual transfer needed. Kept on the class for backward compatibility with V2 integrations.
Starts the match directly, skipping matchmaking. Host-only. Launches a dedicated game server and transitions status to in_game. Use this for “Invite a friend” style lobbies; use FindMatch() for competitive queues.
Action<Lobby>
Callback invoked with the updated lobby data on success.
Action<string>
Callback invoked with an error message on failure.
Host-only. Rematch helper — stops the current game server, returns the lobby to waiting while keeping all players, invite code, and settings intact. Perfect for a “Play again” button. Requires lobby status in_game.If the server stops on its own (TTL, crash, clean exit), the lobby also auto-heals to waiting — no call needed.
Action<Lobby>
Callback invoked with the updated lobby data on success.
Action<string>
Callback invoked with an error message on failure.

Matchmaking

Host-only. Enters the lobby into the matchmaking queue for the given mode. Modes are configured per-project in the dashboard (5v5, 1v1, FFA, party sizes, skill rules, etc.).Subscribe to OnMatchmakingStarted, OnQueueStats, and OnMatchFound / OnMatchAwaitingConfirmation to drive your matchmaking UI. The lobby transitions waiting → in_queue → in_game (or match_found first, if the mode has matchConfirmation enabled).
string
required
Matchmaking mode name (must exist in dashboard config).
Action<Lobby>
Callback invoked once the lobby enters the queue.
Action<string>
Callback invoked on validation/API error.
Host-only. Exits the matchmaking queue. Lobby returns to waiting with all players intact.
Action<Lobby>
Callback invoked when back in waiting.
Action<string>
Callback invoked with an error message on failure.
CS2-style “Accept Match”. Only relevant when the matchmaking mode has matchConfirmation.enabled: true and the lobby is in match_found status. Any player in the lobby can call this. Once every matched lobby confirms, the game server launches and status becomes in_game.Listen for OnMatchAwaitingConfirmation (match pending), OnMatchConfirmed (you/your lobby accepted), and OnMatchDeclined (someone declined or the window timed out — back to waiting).
Action<Lobby>
Callback invoked once the confirmation is recorded.
Action<string>
Callback invoked with an error message on failure.
Declines a found match. Cancels the match for every participating lobby — one dissenter bails everyone. All lobbies (yours included) return to waiting; players must explicitly re-queue if they want to try again. Only valid while the lobby is in match_found.
Action<Lobby>
Callback invoked once the decline is recorded.
Action<string>
Callback invoked with an error message on failure.

Connection Info

Convenience helper that returns the first port as a simple { Ip, Port } tuple. Good for single-port games; for anything else use the named lookups below.
Returns: A ConnectionInfo struct with Ip and Port of the first network_ports entry, or null if no server is running.