Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Beginner question, how to quick join a lobby with two players?

Discussion in 'Lobby' started by neviovalsa, May 4, 2023.

  1. neviovalsa

    neviovalsa

    Joined:
    Jun 24, 2019
    Posts:
    30
    Let's say, me and a friend want to group up before joining a public lobby together, is the following a good strategy to implement it?
    1. Me and my friend form a lobby (with Relay)
    2. I (let's say I'm the host) quick join a lobby that has at least 2 free slots
    3. I connect to the lobby and send a clientRpc to my friend to also connect (passing the lobby id)
    4. I delete my previous lobby
    There doesn't seem to be an "obvious" way to join a lobby with more than 1 player, am I missing something?
     
  2. JeromeIsntDev

    JeromeIsntDev

    Joined:
    Nov 23, 2021
    Posts:
    5
    How I'd personally do it:
    1. Create a 'Group' using a Lobby that does not have a relay connection.
    2. When group leader selects a lobby they'd like to join, send an event that holds the either the allocation id or the lobby to other players in the Group Lobby.
    3. That event will trigger a Join Lobby on the clients of the Group Lobby which will use the information passed through the event to join the "Actual" Lobby.

    Not sure if it makes sense, but that's how I'd do it, conceptually.