public void AddItem(string txt, Action act)
{
GameObject buttonObject = NGUITools.AddChild(grid,buttonPrototype);
UIButton button = buttonObject.GetComponent<UIButton>();
button
.onClick.Add(new EventDelegate
(new EventDelegate
.Callback(act
))); UILabel label = buttonObject.transform.Find("Label").GetComponent<UILabel>();
label.text = txt;
NGUITools.AdjustDepth(buttonObject,11);
}
public void Layout(){
grid.GetComponent<UIGrid>().repositionNow = true;
grid.GetComponent<UIGrid>().Reposition();
}