Authenticate the player via Unity Authentication, then call LobbyService.Instance.CreateLobbyAsync with a lobby name, max players count, and CreateLobbyOptions specifying public visibility and any custom data fields
The host allocates a Unity Relay server by calling RelayService.Instance.CreateAllocationAsync with max connections, then retrieves a join code via GetJoinCodeAsync
Store the Relay join code as a lobby data field by calling LobbyService.Instance.UpdateLobbyAsync with the join code in the lobby data dictionary so joining players can retrieve it
Joining players call LobbyService.Instance.QuickJoinLobbyAsync or JoinLobbyByCodeAsync, then read the Relay join code from the lobby data and call RelayService.Instance.JoinAllocationAsync with it
Both host and joining players pass their respective Relay allocation data to their network transport layer (e.g., Unity Transport) to establish the connection
Implement lobby heartbeat calls on the host side using SendHeartbeatPingAsync to prevent the lobby from expiring during active sessions
Known gotchas
Lobbies expire if the host does not send periodic heartbeat pings; the default timeout is short enough that sessions without heartbeats will disappear from lobby lists mid-game
The Relay join code must be written into lobby data by the host after allocation — it is not automatically present; clients that read lobby data before the host writes the code will find it missing
Relay allocation regions affect latency; not specifying a preferred region lets the service pick one, which may be suboptimal for players in specific geographies
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp