Hello, I recently started a small project and I have found a problem when a client tries to join the server a second time.
I don’t use anything special in my network code. I even created another project with no coding at all, just the basic Unity components. The error still occurs.
Here are the objects in my scenes and their components:
Menu:
- Network Manager: Network Manager, Network Manager HUD, Network Start Location
Game:
- Floor: Box collider
- Directionnal Light: Light
The Network Manager has mostly default values except for the scenes (Menu, Game) and the Player Prefab that is put in to spawn automatically.
Here is the procedure I take:
- Start Hosting a server on the standalone or editor player.
- Join that server with the other application.
- Play. Everything is fine here. I can spawn and move.
- The “joining” client leaves. He goes back to the Menu scene.
- The “joining” client tries to join the server again.
- Error. The screen goes blank. The network manager HUD behaves strangely. It appears that the scene does change to the Game, but nothing is being spawned.
- The “joining” client leaves. He goes back to the Menu scene.
- A warning is given in the console:
“Empty player list given to NetworkServer.Destroy(), nothing to do.
UnityEngine.Networking.NetworkManager:OnServerDisconnect(NetworkConnection)
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()”
The only way the client can rejoin the Hosted game is if the Host leaves and restarts the server. Even then, any joining client can not rejoin once they leave. I have tested this on my local machine and on a friend’s computer. The result is the same.