How to change button’s label text? I tried these codes:
playBtnLabel = playBtn.gameObject.GetComponent<Text>();
// playBtnLabel is null and
playBtnLabel = playBtn.GetComponent<Text>();
// again playBtnLabel is null
What do i do wrong?
How to change button’s label text? I tried these codes:
playBtnLabel = playBtn.gameObject.GetComponent<Text>();
// playBtnLabel is null and
playBtnLabel = playBtn.GetComponent<Text>();
// again playBtnLabel is null
What do i do wrong?
Try
playBtn.gameObject.GetComponentInChildren<Text>();
It works!