- Home /
Question by
michellejean · Sep 30, 2014 at 02:13 AM ·
uibuttontextbeta
Get/Set Button Text with uGUI 4.6
Anyone know how to get and set the text of a button with the new UGUI? I tried: `
string test = button_p3.GetComponent().guiText.ToString();
comes out null.
I would like to be able to change the text written on the button and also read what text is currently on the button (the second one is less important).
Comment
Best Answer
Answer by bundibundi · Sep 30, 2014 at 03:51 AM
Is this what you are looking for?
public Button button1;
void Start()
{
button1.GetComponentInChildren<Text>().text = "la di da";
}