61
NGUI 3 Support / Getting Button that called function
« on: August 29, 2014, 10:24:24 PM »
Hello,
I love how easy it is to have a button in NGUI call a function on its click event. What I am wondering is how can I have multiple buttons call the same function and in the function know which button the call came from? I have a big scroll view list of about 50 buttons, and so it would be nice to have 1 function that all the buttons call and inside the function know which button called it and then handle the event accordingly.
I would think there has to be a way to do this? Can I add some type of parameter to the function that will accept the button object that calls it?
any help would be great, thanks
I love how easy it is to have a button in NGUI call a function on its click event. What I am wondering is how can I have multiple buttons call the same function and in the function know which button the call came from? I have a big scroll view list of about 50 buttons, and so it would be nice to have 1 function that all the buttons call and inside the function know which button called it and then handle the event accordingly.
I would think there has to be a way to do this? Can I add some type of parameter to the function that will accept the button object that calls it?
any help would be great, thanks