I’m trying a very basic configuration for multiplayer games.
I have a NetworkManager with no advanced configuration and a NetworkManagerHUD attached, and I’m trying this inside the editor in Unity 5.2.1f1:
Start the game.
Press “LAN Host”
Press “Client Ready”
At this step, everything works fine and a player prefab is instantiated. But then:
Press Stop
Press “LAN Host”
Press “Client Ready”
And now the player prefab won’t be instantiated.
This also happens when I try to reconnect from another device: I tried building and running in Android, then run in the Editor as Host and in Android as client. The first time the Android client connects everything works fine, but if he leaves and then tries to reconnect, its player object is not created.
If I stop the editor and then start it again, it works once again, just for the first connection.
Have you actually try spawning your player prefabs after you made your clients ready? As in, when you send signals saying clients are ready, you’re just telling the server that the clients are ready, and nothing else. Anything happens after telling the server the clients are ready?
you shouldnt ever have to press the “Client Ready” button unless you have changed the NetworkManager default behaviour. Do you have custom NetworkManager code?
You filled in one of the NetworkManager scene slots but not the other?
It appears that there is a bug when the online scene is set and the offline scene is NOT set, where the local client is not becoming ready. bug 734218 filed on this.
to work-around this, either leave both slots empty or fill them both.
Well, since it’s a bug, let’s continue discussion while they are working on a patch.
By spawning prefabs, what you do is you call on NetworkServer.Spawn() or NetworkServer.SpawnWithClientAuthority() on the server side of your game. Here’s more details.
I am guessing it is also possible to spawn objects in the NetworkManager, when all the clients are telling the server that they are ready.