IEnumerator CheckServer() { clientNetwork = gameObject.AddComponent <TestPlayerClient> (); Debug.Log("Checking for server"); yield return(new WaitForSeconds(1f)); hostDiscovered = clientNetwork.hostDiscovered; if (clientNetwork != null && !hostDiscovered) { Debug.Log("AWWW! Tragedy! Starting as Host"); clientNetwork.StopBroadcast(); Destroy(clientNetwork); yield return(null); } Debug.Log("The Server is " + serverStarted); if (!hostDiscovered && !serverStarted) { Debug.Log("No Server found. Starting as Host"); NetworkServer.Reset(); NetworkManager.singleton.StartHost(); serverNetwork = gameObject.AddComponent <NetworkDiscovery> (); serverNetwork.useNetworkManager = true; serverNetwork.GetComponent <NetworkDiscovery> ().showGUI = false; serverNetwork.Initialize(); serverNetwork.StartAsServer(); serverStarted = true; } }