//----------------------Client Events-------------------- // Called when a player disconnects private void DisconnectedFromServer(NetWorker sender) { NetworkManager.Instance.Networker.disconnected -= DisconnectedFromServer; MainThreadManager.Run(() => { //Loop through the network objects to see if the disconnected player is the host foreach (var no in sender.NetworkObjectList) { if (no.Owner.IsHost) { BMSLogger.Instance.Log("Server disconnected"); //Should probably make some kind of "You disconnected" screen. ah well } } MainScript main = GameObject.FindObjectOfType <MainScript>(); main.CloseSession(); //NetworkManager.Instance.Disconnect(); }); }