public override void OnStopClient() { //Base handling base.OnStopClient(); //Destroy all local players. This will only affect the client stopping not any other client or the server in the match foreach (NetworkPlayer p in PlayersConnected) { if (p != null) { Destroy(p.gameObject); } } PlayersConnected.Clear(); //Fire the event if (ClientShutdown != null) { ClientShutdown.Invoke(); } }
public override void OnStopServer() { //Base handling base.OnStopServer(); //Discconect and destroy all clients on the server and clients for (int i = 0; i < PlayersConnected.Count; i++) { NetworkPlayer p = PlayersConnected[i]; if (p != null) { NetworkServer.Destroy(p.gameObject); } } PlayersConnected.Clear(); //Reset network the scene name networkSceneName = string.Empty; //Fire evemt if (ServerShutdown != null) { ServerShutdown.Invoke(); } }