private void Start() { GameObject lobbyCanvasObj = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject; if (lobbyCanvasObj == null) { return; } CurrentRoomCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <CurrentRoomCanvas>(); // Button button = GetComponent<Button>(); ReadyButton.onClick.AddListener(() => lobbyCanvas.OnReadyButton(PhotonPlayer)); }
//PlayerName public void ChangeName() { if (PlayerName.text.Equals("")) { AndroidNativeFunctions.ShowToast("Name is required"); } else if (PlayerName.text.Length < 4) { AndroidNativeFunctions.ShowToast("Name is too Short"); } else { foreach (var item in l) { if (item.Equals(PlayerName.text)) { ok = false; break; } else { ok = true; } } if (!ok) { Debug.Log("Name already exist"); AndroidNativeFunctions.ShowToast("Name already exist"); } else { PhotonNetwork.playerName = PlayerName.text; nameplayer = PlayerName.text; GameObject lobbyCanvasObj = MainCanvasManager.Instance.CurrentRoomCanvas.gameObject; if (lobbyCanvasObj == null) { return; } CurrentRoomCanvas lobbyCanvas = lobbyCanvasObj.GetComponent <CurrentRoomCanvas>(); lobbyCanvas.OnReadyButton(); } } }