private IEnumerator ConnectToServer() { canConnect = false; ResetState(); try { Log("Connecting to server..."); gameClient.ConnectAsync(TryGetServerAddress(), serverPort); while (gameClient.IsConnecting) { yield return(new WaitForSeconds(0.1f)); } if (gameClient.IsConnected) { LogDebug("Connected to the server"); yield break; } LogError("Unable to connect to server"); yield return(new WaitForSeconds(1)); } finally { canConnect = true; } }
private void ConnectToServer() { gameClient.ConnectAsync(TryGetServerAddress(), settings.ServerPort); }