question

Stefan Petre avatar image
Stefan Petre asked

Unity Relay with Playfab Lobby

Hello, I'm using unity relay to set up the peer-to-peer connections for my Unity game that uses Netcode for GameObjects. Previously, I was using Unity Lobby, which I have replace it with Playfab Lobby. But now I'm facing an issue on how I can transfer the relay code to the players in the Lobby. I've tried to set it up the relay code as part of the lobby data, but then I have no clue how to fetch it from the joining player. Here's the snipet of my code for creating the lobby:

             var createRequest = new CreateLobbyRequest()
             {
                 LobbyData = new Dictionary<string, string>()
                 {
                 {"RelayCode",relayJoinCode}},
                 MaxPlayers = 2,
                 OwnerMigrationPolicy = OwnerMigrationPolicy.None,
                 Owner = new EntityKey()
                 {
                     Id = playerId,
                     Type = "title_player_account"
                 },
                 Members = new List<Member>
                     { new Member() { MemberEntity = new EntityKey()
                         {
                             Id = playerId,
                             Type = "title_player_account"
                         }
                     }
                 },
                 UseConnections = false,
             }; 
unity3d
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Infer Wang avatar image
Infer Wang answered

Lobby data is the private key-value pairs which are visible to all entities in the lobby. Lobby - Get Lobby - REST API (PlayFab Multiplayer) | Microsoft Learn will return Lobby data.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.