- Home /
Question by
callcter · Jan 21, 2016 at 08:37 AM ·
unity 5gui.button
Something wrong when binding event on button
here is my code:
void Awake(){
Button[] btnArr = GetComponentsInChildren<Button> (true);
for (int i = 0; i < btnArr.Length; i++) {
btnArr [i].onClick.AddListener (btnClick);
}
}
private void btnClick(){
Debug.Log (this.name);
}
it doesn't work
Comment