Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Relay and Lobby integration

Discussion in 'Multiplayer' started by Wawro01, Mar 31, 2022.

  1. Wawro01

    Wawro01

    Joined:
    Apr 23, 2014
    Posts:
    44
    Hello,

    I am trying to grasp how Relay and Lobby works together.

    Let's imagine simple usecase when player A creates a Lobby, then user B join lobby as well.
    User A will connect to Relay service and will provide AllocationID and join code.

    Code (CSharp):
    1.  
    2. UpdatePlayerOptions updateOptions = new UpdatePlayerOptions
    3.             {
    4.                 // Data = data,
    5.                 AllocationId = allocationId,
    6.                 ConnectionInfo = joinCode
    7.             };
    8. await Lobbies.Instance.UpdatePlayerAsync(lobbyId, playerId, updateOptions);
    9.  
    Then player B joins relay as well.

    According to this documentation I was suspecting that after shutting down Relay connection on player A, lobby should get updated automatically and probably new host should be chosen, but it is not clear tbh.

    What is the purpose of providing AllocationID to Lobby or I am missing something? Is the Relay service talking to Lobby service or this needs to be implemented on Host?

    Thanks
     
  2. skizerzz

    skizerzz

    Joined:
    May 14, 2021
    Posts:
    2
    I know this is an old post but the documentation really does need to add more detail as to exactly what setting the AllocationId on the Player actually achieves. Does anyone have any clarification on this? I have Lobby and Relay working just fine, and I am setting the Player AllocationId successfully, but I am not certain what it accomplishes.