private void HandleDisconnect(Exception ex) { mainThreadInvoker.Add(() => { txtStatus.text = "Disconnected from server"; var userNames = _gameManager.Players.Keys; int count = userNames.Count; foreach (var key in userNames) { _gameManager.Players[key].enabled = false; } }); }