PlayFlowLobbyManagerV2 class.
Properties
Singleton instance of the Lobby Manager. Access all lobby functionality through this.
Returns true if the manager has been successfully initialized.
Gets the full data for the lobby the player is currently in. Returns null if not in a lobby.
Gets the unique ID of the current player, as provided during initialization.
Gets the current state of the lobby session (e.g., Disconnected, InLobby).
Provides access to all lobby-related UnityEvents (e.g., OnLobbyJoined, OnPlayerLeft).
A cached list of all currently available public lobbies. This list is updated automatically if auto-refresh is enabled.
A quick check to see if the player is currently in a lobby.
Returns true if the current player is the host of the lobby they are in.
Gets the invite code for the current private lobby. Returns null if not in a private lobby.
Methods
Initialize
Initialize
CreateLobby
CreateLobby
Creates a new lobby. There are two overloads for this method.Pass Detailed:
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:The public name of the lobby.
The maximum number of players.
If true, the lobby will not appear in public searches.
If true, delete any lobby the local player already hosts before creating a new one. Defaults to
false.Callback invoked with the created lobby data on success.
Callback invoked with an error message on failure.
The public name of the lobby.
The maximum number of players that can join.
If true, the lobby will not appear in public searches.
If true, players can join even after the match has started.
The server region for the lobby (e.g., “us-west”).
A dictionary of custom game-specific settings.
If true, delete any lobby the local player already hosts before creating a new one. Defaults to
false.Callback invoked with the created lobby data on success.
Callback invoked with an error message on failure.
CreateFreshLobby
CreateFreshLobby
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.The public name of the lobby.
The maximum number of players. Defaults to
4.If true, the lobby will not appear in public searches.
Callback invoked with the created lobby data on success.
Callback invoked with an error message on failure.
JoinLobby
JoinLobby
JoinLobbyByCode
JoinLobbyByCode
GetAvailableLobbies
GetAvailableLobbies
LeaveLobby
LeaveLobby
UpdatePlayerState
UpdatePlayerState
Updates the local player’s custom state data within the lobby. This is useful for synchronizing data like character selection or ready status.
A dictionary representing the player’s custom data.
Callback invoked with the updated lobby data on success.
Callback invoked with an error message on failure.
UpdateStateForPlayer
UpdateStateForPlayer
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).The unique ID of the player whose state you want to update. Must equal the local player ID.
A dictionary representing the new data for the target player.
Callback invoked with the updated lobby data on success.
Callback invoked with an error message on failure.
KickPlayer
KickPlayer
Kicks a player from the lobby. This can only be called by the host.
The unique ID of the player to remove from the lobby.
Callback invoked with the updated lobby data on success.
Callback invoked with an error message on failure.
UpdateLobby
UpdateLobby
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.New lobby name (3–50 characters).
New max player count (1–100).
Toggle public/private listing.
Enable or disable invite codes.
Allow players to join after the match starts.
Region for the next game server (e.g.
"us-west").Replace the custom settings blob.
Callback invoked with the updated lobby data on success.
Callback invoked with an error message on failure.
UpdateLobbySettings
UpdateLobbySettings
Convenience shortcut for
UpdateLobby(customSettings: newSettings). Host-only. Use this when you only need to update the customSettings dictionary.New custom settings dictionary (replaces the existing one).
Callback invoked with the updated lobby data on success.
Callback invoked with an error message on failure.
DeleteLobby
DeleteLobby
TransferHost (V3: not supported)
TransferHost (V3: not supported)
StartMatch
StartMatch
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.Callback invoked with the updated lobby data on success.
Callback invoked with an error message on failure.
EndMatch
EndMatch
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.Callback invoked with the updated lobby data on success.
Callback invoked with an error message on failure.
Matchmaking
FindMatch
FindMatch
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).Matchmaking mode name (must exist in dashboard config).
Callback invoked once the lobby enters the queue.
Callback invoked on validation/API error.
CancelMatchmaking
CancelMatchmaking
ConfirmMatch
ConfirmMatch
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).Callback invoked once the confirmation is recorded.
Callback invoked with an error message on failure.
DeclineMatch
DeclineMatch
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.Callback invoked once the decline is recorded.
Callback invoked with an error message on failure.
Connection Info
GetGameServerConnectionInfo
GetGameServerConnectionInfo
Convenience helper that returns the first port as a simple Returns: A
{ Ip, Port } tuple. Good for single-port games; for anything else use the named lookups below.ConnectionInfo struct with Ip and Port of the first network_ports entry, or null if no server is running.Port lookups (by name) — recommended
Port lookups (by name) — recommended
Look up a network port by the name you defined in your project’s port configuration (e.g. The full
"game_udp", "voice_tcp"). These live directly on Lobby (and mirror to GameServerInfo) so you don’t need to hand-code server.network_ports[0] and hope.GameServerPort shape matches the servers API: name, internal_port (what your game binds to inside the container), external_port (what clients connect to), protocol (udp / tcp), host, tls_enabled. Connect with host:external_port.