EDIT: I had a breakthrough! I mostly found the answer, although it creates some follow-up questions. See below!
With HLAPI (LobbyNetworkManager / NetworkLobbyPlayer classes), How do I properly leave a lobby room as a host? As a client?
The documentation is incredibly minimal, if not non-existing altogether O__o I am stumped. I’m trying a few things which I’ll start documenting below.
GOT IT!! Not sure if this is standard (if a Unity dev pops in, let me know):
User clicks the “stop queue” arbitrary button to trigger the NetworkLobbyManager class script to:
if (this.matchInfo != null)
this.StopHost();
- When a client does this, the client immediately leaves the lobby. Don’t be fooled by the word host - this will do client events if client. This is what through me off the most: I’m thinking “hm i’m a client not a host…”.
- The “real host” remains in the lobby and others can join.
- If you list and join/create matches thereafter, it will work with no error!
- Still testing what happens if the match host uses StopHost()
Remaining questions:
- Will StopHost, if used by a host, kick off all the clients?
- ^ If so, how would I migrate the host? Shame if 14 people queued up and the host leaves, kicking everyone out… right?
1 Like
When I host a match, make a second client join and alt+f4 the host instance, my second client is kicked out of the lobby. I think this will happen also for your case. But I know there is something called HostMigration. But I just didnt look into it because I am still in early development stage. Thanks for your evaluations!