void Start() { GameObject lobbyCanvasObj = MainCanvasManager.instance.lobbyCanvas.gameObject; if (lobbyCanvasObj == null) { return; } LobbyCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas>(); Button button = GetComponent <Button>(); button.onClick.AddListener(() => lobbyCanvas.OnClickJoinRoom(roomNameText.text)); }
// Use this for initialization private void Start() { //get the LobbyCanvas GameObject in Main Canvas GameObject lobbyCanvasObj = MainCanvasManager.Instance.lobbyCanvas.gameObject; if (lobbyCanvasObj == null) { return; } //get the lobbyCanvas srcipt in lobbyCanvas Object LobbyCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas> (); //Add button listener and call the LobbyCanvas.OnClickJoinRoom function by pressed the button Button button = GetComponent <Button> (); button.onClick.AddListener(() => lobbyCanvas.OnClickJoinRoom(RoomName)); }
// set up a listener private void Start() { GameObject lobbyCanvasObj = MainCanvasManager.Instance.LobbyCanvas.gameObject; //This shouldn't happen but if it does then we have a check if (lobbyCanvasObj == null) { return; } LobbyCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <LobbyCanvas> (); Button button = GetComponent <Button> (); button.onClick.AddListener(() => lobbyCanvas.OnClickJoinRoom(RoomNameText.text)); }
private void Start() { //Getting the Lobby Canvas object GameObject LobbyCanvasObj = MainMPCanvasManager.Instance.LobbyCanvas.gameObject; if (LobbyCanvasObj == null) { return; } LobbyCanvas lobbyCanvas = LobbyCanvasObj.GetComponent <LobbyCanvas>(); //Get the Room Name text Button button = GetComponent <Button>(); button.onClick.AddListener(() => lobbyCanvas.OnClickJoinRoom(RoomNameText.text)); }
// Start is called before the first frame update private void Start() { GameObject LobbyCanvasObject = MainCanvasManager.Instance.LobbyCanvas.gameObject; if (LobbyCanvasObject == null) { return; } LobbyCanvas lobbyCanvas = LobbyCanvasObject.GetComponent <LobbyCanvas>(); Button button = GetComponent <Button>(); if (button == null) { print("button is null"); } button.onClick.AddListener(() => lobbyCanvas.OnClickJoinRoom(RoomNameText.text)); }
void OnDoubleClick() { lobbyCanvas.OnClickJoinRoom(RoomNameText.text); blockRaycastRoom.SetActive(true); }