public void TearDown() { // stop server/client NetworkClient.DisconnectLocalServer(); NetworkClient.Disconnect(); NetworkClient.Shutdown(); NetworkServer.Shutdown(); // destroy left over objects foreach (GameObject item in spawned) { if (item != null) { GameObject.DestroyImmediate(item); } } spawned.Clear(); NetworkIdentity.spawned.Clear(); GameObject.DestroyImmediate(Transport.activeTransport.gameObject); }
public void TearDown() { NetworkClient.DisconnectLocalServer(); NetworkClient.Disconnect(); NetworkClient.Shutdown(); if (NetworkServer.active) { NetworkServer.Shutdown(); } if (Transport.activeTransport != null) { GameObject.Destroy(Transport.activeTransport.gameObject); } }
private IEnumerator DisconnectCoroutine(TaskCompletionSource disconnectTask) { if (MvNetworkManager.I.IsHost) { NetworkClient.DisconnectLocalServer(); _networkManager.StopClient(); } else { _networkManager.client.connection.Disconnect(); _networkManager.client.connection.InvokeHandler(new DisconnectMessage(), -1); } yield return(new WaitUntilTimeout(() => !NetworkClient.active && !NetworkClient.isConnected)); disconnectTask.SetResult(); }
/// <summary> /// disconnect host mode. this is needed to call DisconnectMessage for /// the host client too. /// </summary> public void DisconnectLocalServer() { NetworkClient.DisconnectLocalServer(); }