Error attempting to change text on instantiated button

Hi,

I’ve looked through multiple posts but can’t seem to find out what I’m doing wrong. I’ve Instantiated a button prefab, added it to panel, set its scale, changed its name all fine. But when I attempt to change the text on the button I get the following error:

Assets/Scripts/gameSystem.cs(102,33): error CS0029: Cannot implicitly convert type UnityEngine.UI.Text[]' to UnityEngine.UI.Text’

The error points to the line “buttonText = newButton.GetComponentsInChildren();”

buttonDescription = objectDetail.objectTitle;

				GameObject newButton = Instantiate(buttonPrefab) as GameObject;

				Text buttonText;
				buttonText = newButton.GetComponentsInChildren<Text>();
				buttonText.text = buttonDescription;
				newButton.transform.parent = buttonParent.transform;
				newButton.transform.localScale = Vector3.one;

				newButton.name = "objButton" + i;

Thanks

Instead of create and assigning the text component.

Try to access it directly

 newButton.GetComponentsInChildren().text=buttonDescription;