I made a button prefab with 3 UI.Text
I wanted to edit the UI.Text through script whenever the button prefab are instantiated
but, I notice that the variables linked to the UI.Text inside prefab are then canceled or unlinked
public class GoalList:MonoBehaviour {
public int numPick;
public Text nameText;
public Text priceText;
public Text statusText;
public string name;
public float price;
public string status;
bool reInfo = false;
void Start()
{
Button buttonCtrl = this.GetComponent<Button> ();
buttonCtrl.onClick.AddListener (() => myButtonDelegate (numPick));
reInfo = true;
}
void Update()
{
if (reInfo) {
InsertDetails ();
reInfo = false;
}
}
public void InsertDetails()
{
nameText.text = name;
priceText.text = price;
statusText.text = status;
}
what should I use to find the 3 UI.Text or how to set the object reference to an instance of an object in prefab