/// <summary> /// Function that handles back button in the lobby /// It's sends to message about user exiting the lobby to the server and destroys client /// </summary> public void LobbyBackButton() { GameManager.Instance.players.Clear(); PlayerList playerList = GameObject.Find("PlayerList").GetComponent <PlayerList>(); playerList.ClearPlayerList(); Client c = FindObjectOfType <Client>(); c.Send("CEXIT"); if (c != null) { Destroy(c.gameObject); } mainMenu.SetActive(true); connectMenu.SetActive(false); lobbyMenu.SetActive(false); }