for (int n = 0; n < ship.Count; n++)
{
GameObject o = Instantiate(shipButton) as GameObject;
UIButton button = o.GetComponent<UIButton>();
button
.onClick.Add(new EventDelegate
(this,
"ButtonShipPressed"));
UILabel label = o.GetComponentInChildren<UILabel>();
label.text = ship[n].Name;
// ...and other misc layout stuff...
}
public void ButtonShipPressed()
{
Debug.Log("Which one was clicked?");
}