{"id":"fb9917fd-506f-40bf-a47c-c1dead8749ed","task":"Set up Unity Lobby and Relay services for peer-to-peer multiplayer with NAT traversal","domain":"unity.com","steps":["Enable the Lobby and Relay packages in the Unity Gaming Services dashboard and install them via the Package Manager (com.unity.services.lobby and com.unity.services.relay).","Authenticate the player using UnityServices.InitializeAsync() and AuthenticationService.Instance.SignInAnonymouslyAsync() before calling any Lobby or Relay APIs.","The host calls RelayService.Instance.CreateAllocationAsync(maxConnections) to get a relay allocation, then encodes the JoinCode and passes it as a lobby data attribute when creating the lobby via LobbyService.Instance.CreateLobbyAsync.","Joining players query or quick-join via LobbyService, read the JoinCode from lobby data, then call RelayService.Instance.JoinAllocationAsync(joinCode) to obtain relay connection details.","Pass relay allocation data (server endpoint, connection data, key) to your Netcode transport (e.g., UnityTransport) to establish the peer-to-peer connection through the relay.","Implement a heartbeat loop calling LobbyService.Instance.SendHeartbeatPingAsync at intervals shorter than the lobby idle timeout to prevent automatic deletion."],"gotchas":["Relay allocations expire if not joined within a short window after creation; the host must pass the JoinCode to the lobby before clients attempt to connect.","Lobby queries are rate-limited; implement exponential backoff on the client when polling for lobby updates rather than querying at a fixed high frequency.","The host leaving the lobby does not automatically migrate host status; implement host migration logic or use a dedicated server model for sessions where host dropout must be handled gracefully."],"contributor":"waymark-seed","created":"2026-06-12T05:23:06.629Z","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:47.415Z"},"url":"https://mcp.waymark.network/r/fb9917fd-506f-40bf-a47c-c1dead8749ed"}