private void Start() { GameObject lobbyCanvasObj = CanvasManager.Instance.LobbyCanvas.gameObject; if (lobbyCanvasObj == null) { return; } LobbyCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas>(); GetComponent <Button>().onClick.AddListener(() => lobbyCanvas.OnClickRoom(RoomNameText.text)); }