UNET Multiplayer Lobby not creating an instance of the lobby player

I’m trying to create a multiplayer lobby with UNET. I have a game object in my lobby scene with the Network Lobby Manager component attached to it. The Lobby Player variable has a reference to a prefab with a Network Identity and Lobby Player component. I’m wanting to build the GUI from scratch rather than using the Network Manager HUD so I have some buttons such as “Start Host” and “Start Client”.

Clicking the “Start Host” button calls “StartHost()” and I get debug telling me that the host has been started and that a server and a client has connected. However I was under the impression after reading through the documentation, that when a client connected (I’ve tried this locally and not) that the lobby manager instantiates a lobby player automatically for every connected client. Mine doesn’t do this.

Setting the log level of the Network Lobby Manager to Debug instead of Info, I get some extra debug that says “Ready with no player object” but I don’t know whether that is in relation to something failing and not being able to instantiate a Lobby Player?

Has anyone had a similar situation? Or know of any tutorials or documentation on creating a UNET lobby? I have read all the documentation in the manual (which I find very shallow) and I’ve also downloaded the Network Lobby and Network Starter sample projects. I can’t see any other code they call in order to work and my manager setups are the same. Am I missing a certain call??

Thank you!

I had this issue even with Auto Create Player set to true.

It was because OnServerAddPlayer was exiting the function early because the loaded scene wasn’t the scene it expected as the ‘lobby’ scene. If you look at this function in the source (the HLAPI is all on bitbucket, I highly recommend downloading it) you can see the first thing it checks is if the current scene is the lobby scene it expects.

I had inconsistent behaviour with this as sometimes the scene would load in the editor fine and a lobby player would be created but most of the time it wouldn’t work. Additionally as this is the ‘desired’ behaviour nothing is logged.

For me this is because I was creating/joining a matchmaker game from one screen and loading the lobby scene in the same function. I now use a scene loading system I’ve made to determine when the scene is fully loaded before trying to start/join the match and the problem is gone.

Hope that helps anyone else who comes across this like I did.