Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: rxmarcus on August 29, 2014, 10:24:24 PM

Title: Getting Button that called function
Post by: rxmarcus 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
Title: Re: Getting Button that called function
Post by: ArenMook on August 30, 2014, 09:28:55 AM
UIButton.current tells you which button it came from. It's the same with any NGUI event. UISlider.current, UIToggle.current, UICamera.current, etc.
Title: Re: Getting Button that called function
Post by: rxmarcus on September 01, 2014, 12:20:36 PM
Thank you, that works great.