public void ListGames() { lobby.gameObject.SetActive(true); MenuPlay.gameObject.SetActive(false); GameObject lobbyCanvasObj = MainCanvasManager.Instance.LobbyCanvas.gameObject; if (lobbyCanvasObj == null) { return; } LobbyCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas>(); lobbyCanvas.getit(); }