public void OnDisable() { if (networkManager != null) { if (networkManager.matchMaker != null) { Debug.Log("Disabling Matchmaker"); networkManager.StopMatchMaker(); } ClearRoomList(); } if (networkDiscovery != null) { Debug.Log("Stoping Listening for LAN Servers"); if (networkDiscovery.isClient) { networkDiscovery.StopBroadcast(); } } }
/// <summary> /// wait for connection if timeout then remove the waitscreen /// </summary> /// <returns></returns> IEnumerator WaitForHostToStart() { WaitScreen.SetActive(true); int countdown = 8; while (countdown > 0) { yield return(new WaitForSeconds(1f)); countdown--; } networkManager.StopHost(); if (networkDiscovery.isServer) { networkDiscovery.StopBroadcast(); } WaitScreen.SetActive(false); }