instantiate buttons with loop

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));
		}

		}

You can use the name property to set these, assuming you’re talking about UI Buttons…

GameObject CreateButton(string buttonName, float x, float y) {
        var button = (GameObject) Instantiate (MyButtonPrefab, new Vector3(x,y,0), Quaternion.identity);
        button.transform.SetParent (transform, false);
        button.name = buttonName;
        allButtons.Add(button); // perhaps you need to disable/reenable all buttons at some point?
        return button;
    }