- Home /
UNet NetworkLobbyManager can't connect with ip address/
I am currently trying to create a lobby where player can connect to it with the network discovery component. To do so I first tried that everything works with the default NetworkManager
. To try it I had a simple setup in my scene. I had the NetworkManager
which I extended with the following code:
public class MyNetManager : NetworkManager
{
public NetworkDiscovery discovery;
public override void OnStartHost()
{
discovery.Initialize();
discovery.StartAsServer();
}
public override void OnStartClient(NetworkClient client)
{
discovery.showGUI = false;
}
public override void OnStopClient()
{
discovery.StopBroadcast();
discovery.showGUI = true;
}
}
This extension is quite straight forward. I take the advantage of the NetworkDiscovery
to connect to the Game. As expected when someone is hosting a game, the NetworkDiscovery
finds this game and can connect to it.
The Problem
When I tried to change the NetworkManager
to a NetworkLobbyManager
I started to get weird issues. First issue was that when someone tried to connect to a lobby with the NetworkDiscovery
it threw an error saying that the lobbyPlayer needs to be added to the spawn able objects, which I found weird as it never asked me to do this when trying to connect to the localhost. After adding the LobbyPlayer and trying again to connect to the lobby I get another error. On the client it was giving an Index out of Range
error. After investigating I found out that the error came from the LobbyPlayer script at this line: lobby.lobbySlots[m_Slot] = this;
. So basically it failed to add the player on the client, however, I did see the 2 players connected on the host.
Finnally it also gave me an error when trying to set ready on the client in the lobby. Unknown message ID 43 connId: 1
So my questions are
Why did it ask for me to add the playerLobby to be added to the spawn-able objects?
Why did it fail to add the player on the client but not on the host?
Is there any way I can use the network discovery with the NetworkLobbyManager?
Thanks in advance and if any other information is needed I'll happily provide it.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Need help converting js to c# 4 errors 1 Answer
NetworkMessage Class for Error 1 Answer
"Strange behaviour may occur" when using Network.AllocateViewID() 0 Answers
Choose Player UNet Problem with Client 0 Answers