Transform items = transform.FindChild ("items");
for (int i = 0; i < 6; i++) {
UIButton btn = items.GetChild (i).GetComponentInChildren<UIButton> ();
EventDelegate.Add (btn.onClick, delegate() {
OnItem (i);
});
}
public void OnItem(int i){
Debug.Log (i);
}
there is 6 button,name is 1,2,...6,click the button,log always is 7,
How to make log is 1,2,3,4...6?