So in my game I have a main menu, with a custom lobby and networkManager that receives players, lets them customize, set a ready flag and then the server loads into the main scene where the game happens, all is fine and dandy. However, I am now trying to implement a way to return to the lobby. I had to rewrite a lot of how my objects are spawned and other logic, but I finally got to a place where I can return to the lobby and start the game again just fine when playing alone (Just as a server and local client)
When I try to build the game however I start running into problems. Everything works fine, connects, transitions into the main scene, but when I try to return to the lobby it just mucks it up. It runs the exact same code as going from the lobby to the game (only with a different scene index), but for some reason the client returns to the correct scene, but the host freezes up completely, up until I give up and exit the client, at which point the server somehow manages to finish, and returns to the lobby.
Here’s the code for changing scene I’m using, as well as a routine that detects when the scene is finished loading and then does some extra stuff, but I don’t think that’s affecting this. Hopefully someone here has had some sort of experience with this because I’m very confused about it.
Here’s a dropbox link to a folder with the different logs described below, I had lots of problems trying to attach them here so hope this is an okay substitute: Dropbox
I did some testing, and found these scenarios:
When the editor is the host, with a build as client, the client instantly loads into the lobby, and the host freezes. After about 2 minutes client gets “ChannelBuffer buffer limit of 16 packets reached”. I stopped the client after 5 minutes, then the host loaded into the lobby. I’ve attached the log for the build aptly named “output_log editorAsHost.txt”
When the build is the host both the editor and the build freezes for about 1 minute and 40 seconds before the build manages to load into the lobby and the editor follows right after, so this works, only with a 1 minute 40 second delay which sounds ridiculous.
When I open up the game in two separate builds it does basically the same as the above version, but it “only” takes about 40 seconds. I’ve attached the log for this as “output_log bothBuilds.txt” (FYI the log had a lot of repeated errors that made the file too large to upload so I removed a sizeable amount of them, the error is still there, just not as many times)
Lastly I tested with both the host and client as builds, and oddly enough this seems to perform the same as if the editor is the host. So the client loads into the lobby, then the host freezes. The client starts getting the same channelbuffer error after a bit. I’ve attached both logs as “output_log Host buildsDifferentComputers.txt” and “output_log Client buildsDifferentComputers.txt”
I’m really stumped at this so any wisdom anyone could share would be very much appreciated.
Yeah, I assume the ChannelBuffer error is because the client doesn’t get a response from the server. I’ve set the timeout to 30 seconds, if not it would simply get a disconnect error almost immediately. That does make it a bit weird that it takes so long without getting a disconnect though.
I’m making a custom NetworkManager because the default one didn’t fit our needs. I set the connectionconfigs when the server sets up or the client connects using
I’m not an expert so I can just tell you what i’d check :
“Instance not found when handling Command message [netId=13]”
When you’re going back to your lobby, the player (= object with networkidentity) is deleted, but it seems that something is still trying to send him data.
Maybe the player isn’t deleted server side or something.
Maybe the player is not properly replaced by the lobbyPlayer
Make sure all your builds have the same NetworkMessages ids
Finding your NetworkIdentity with ID 13 (or 14, also seen in your errors) might help.
Do you have an enabled playerlobby or player object left in your scene ?
I do have a player object left in the scene, because I spawn a lobby player based off of it, then delete the initial player object after (again, bespoke code), but those are excellent tips, I’ll have a look at those, thanks