Hi there! I’m currently working on an online multiplayer game using Mirror. The game works perfectly on the first try when a host starts a server and the clients connect.
However, after playing for a bit and the host decides to disconnect to the main menu, when it goes to start the server and play again (without closing the game) the game breaks.
The errors that appear and break the game are all to do with getting a NullReferenceException on the PlayerScript (which is a NetworkBehaviour on each client), every time “gameObject” is called. This is strange because in my eyes gameObject should always be accessible, because if it were null the script that called it couldn’t even be able to run in the first place, right?
I’ve tried looking online but there isn’t much documentation on how to properly stop and reset a Mirror server, and I’m baffled as to why this is happening.
I’m using NetworkServer.Shutdown() to stop the server.
Any help greatly appreciated!