After calling StopHost() on the server and clients, the previously connected clients can no longer connect to any new games. (though new games can still be hosted)
Should I be doing something else too?
(note: not using Unity’s matchmaker, I’m using NAT Punchthrough and my own server to set up initial connections)
I’m using the latest version of Unity, 2017.1.0f3.
If you are using some custom Unity UI to interact with your “Custom Network Manager”. Make sure you don’t loose your script class refences when going back to the “Join Scene”.
Other than that. Instead of calling StopHost on clients. Use StopClient. And for Servers, use StopServer. Only use StopHost for the actual host. Might have something to do with it.
Thanks, this was part of the problem. Been working on the problem ever since I posted here, just now got it fixed. Part of the issue was RakNet (what I’m using for punchthrough) needed to be shutdown and re-booted after leaving a match.
Though I also had to Destroy() and re-Instantiate() the NetworkManager at the end of every match, too. I can’t tell you why I had to do this, all I know is something was different (causing the player to be unable to join) after joining & disconnecting from a match, and due to lack of information online, resetting the NetworkManager to it’s original state (via prefab) was kinda my only option. I know it sounds really hack-y, and it is, and although I’d rather know exactly what the hell was happening, it works perfectly fine and I don’t see it causing any problems in the future.
Thanks for the reply. Null references was my very first thought when this started happening a few weeks ago, triple checked everything and that was not the issue. Though the problem is fixed now as I mentioned above. I also tried StopHost/Client, in the end I ran StopHost on both host/client and it’s all working as expected. (although it didn’t when I used StopHost/Client)