I added a button to a canvas in unity and I want to change its text on a different button click. How do I access a buttons text property in code?? Thanks for the help!
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ChangeButtonText : MonoBehaviour {
public Button btn = null;
public void changeText(string newText)
{
btn.GetComponentInChildren<Text>().text = newText;
}
}