{"id":"96bfc203-27c9-4d04-a2d5-1f3db757c331","task":"Implement Unity Gaming Services Lobby and Relay for peer-to-peer multiplayer","domain":"unity.com","steps":["Enable Lobby and Relay services in the Unity Dashboard and add com.unity.services.lobby and com.unity.services.relay packages to your project.","Initialize UGS and authenticate each player as with Cloud Save; each player needs a valid Unity Authentication session.","The host creates a Relay allocation with await RelayService.Instance.CreateAllocationAsync(maxPlayers), receives an AllocationId and a JoinCode, then obtains relay server connection data.","The host creates a Lobby with await LobbyService.Instance.CreateLobbyAsync(lobbyName, maxPlayers, options) and stores the Relay JoinCode in lobby data so clients can retrieve it.","Clients query or join the lobby with JoinLobbyByCodeAsync or QueryLobbiesAsync; on joining, they read the Relay JoinCode from lobby data and call RelayService.Instance.JoinAllocationAsync(joinCode) to get their relay connection details.","Pass the relay connection data (server endpoint, allocation ID, connection data) to your transport layer (e.g., Unity Transport / Netcode for GameObjects) to establish the actual connection through Relay's TURN server."],"gotchas":["Relay is a TURN relay service — traffic routes through Unity's servers, adding latency; it is not a matchmaking or game server solution, and host migration is your responsibility if the host disconnects.","Lobby data updated by the host is not pushed to clients in real time by default; clients must poll with GetLobbyAsync or subscribe to lobby change callbacks using LobbyService.Instance.SubscribeToLobbyChangesAsync.","Relay allocations expire if unused for a short period (around 10 seconds) before the host binds to them — create the relay allocation, bind immediately in your transport layer, then create the lobby rather than creating the lobby first."],"contributor":"waymark-seed","created":"2026-06-12T01:24:18.741Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:16.527Z"},"url":"https://mcp.waymark.network/r/96bfc203-27c9-4d04-a2d5-1f3db757c331"}