Search Unity

Question After migrating lobby host, how to have the NetworkManager become the host?

Discussion in 'Lobby' started by Shack_Man, Aug 20, 2023.

  1. Shack_Man

    Shack_Man

    Joined:
    Jun 7, 2017
    Posts:
    372
    I'm a bit lost here... I can update the host of the lobby by going through the list of players and set the hostID to someone that wasn't the host before, then update the lobby data, all good.

    But that seems to be only the first step, how does that new lobby host now become a real host, like in the NetworkManager? It seems that updating the lobby hostID has no effect.
     
  2. Mj-Kkaya

    Mj-Kkaya

    Joined:
    Oct 10, 2017
    Posts:
    179
    What is the "NetworkManager? Are you using "Lobby" and "Netcode for GameObject" packages in the same project?
     
  3. Shack_Man

    Shack_Man

    Joined:
    Jun 7, 2017
    Posts:
    372
    Yes, I'm using both. First I check with QuickJoinLobby if there is an open one and if so, get the joincode from it and join, then I call NetworkManager.Singleton.StartClient();
    Otherwise I create a lobby, set the relay allocations, and call NetworkManager.Singleton.StartHost();

    When I migrate the lobby host, the NetworkManager stays the same. If the host shuts down after migrating the lobby, a new player does not find that lobby.
     
  4. Mj-Kkaya

    Mj-Kkaya

    Joined:
    Oct 10, 2017
    Posts:
    179
    Yes they have separate Host.
    Lobby has Host migration but Relay doesn't have.
    And most important Host in your situation is Relay's Host.
    Because Network Manager's Host is also Relay's Host.
     
  5. Shack_Man

    Shack_Man

    Joined:
    Jun 7, 2017
    Posts:
    372
    oh damn, so that means host migration in terms of lobby is only passing on who can change settings? But if the NetworkManager host decides to leave the game, it's over for every one?
     
  6. Mj-Kkaya

    Mj-Kkaya

    Joined:
    Oct 10, 2017
    Posts:
    179
    Yes, Lobby's Host only responsible on Lobby stuff.

    Yes, it is.

    If you interest on Host Migration on Relay/NGO you can quick search in NGO forum.
     
  7. Shack_Man

    Shack_Man

    Joined:
    Jun 7, 2017
    Posts:
    372
    Okay, looks like that isn't supported yet and doing it on your own can get messy. I might put that off for now and replace players with bots ;-)

    Thank you very much for your help!
     
    Mj-Kkaya likes this.
  8. arwe2793

    arwe2793

    Joined:
    Oct 18, 2012
    Posts:
    25

    how to do lobby host migration? if host crashes or his wifi disconnects, lobby is destroyed after 30s ... how to detect if lobby host is offline and transfer host role to new client?