hi i want to create different buttons for my objects. i used that script but it doesnt work properly. every instantiated buttons has same text(first object’s name from list). what i miss?
foreach(GameObject frui in fruits)
{
GameObject go = (GameObject)Instantiate(fruitbutton);
go.transform.parent = table.transform;
go.GetComponentInChildren<Text>().text = frui.GetComponent<fruitscript>().fruitname;
go.GetComponent<Button>().onClick.AddListener(() => PriceList(frui));
}
}