Unity multiplayer training - Host Error exiting game

I was able to figure out how to stop the Object reference not set to an instance of an object error from appearing on the host console when stopping a game or leaving a game.

I added a safety check to HandlePlayerDespawned to check if the network is in the process of shutting down so it doesnt try to update the NetworkList variable. I added the line if (NetworkManager.ShutdownInProgress) return;

I thought it might be helpful to anyone else. I saw other threads about the same question but they didn’t really seem to solve it.

1 Like

Cool, thanks for the tip and for sharing!

Privacy & Terms