Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Tama on July 04, 2014, 09:27:47 AM
-
I'm trying to make a set of buttons that call the same function but with a different argument value. I saw that back in 2012, someone had the same problem here:
http://www.tasharen.com/forum/index.php?topic=2353.0
and never solved it. I can see that if I add a button and put in a method that takes parameters, the button inspector shows an "Arg 0" field, but that seems to want me to drag in a gameobject. I want to be able to pass a string or int, for instance, not a gameobject.
I know I can make different methods that just differ in what value they pass on, and then attach each button to one of these methods, but I was wondering if there was a neater solution?
-
There are a couple of options (neither of which give you exactly what you want, but might be of use to you)...
One approach in this thread: http://www.tasharen.com/forum/index.php?topic=10206.msg47892#msg47892
Another is to not pass a parameter at all, but use UIButton.current to identify which button was pressed and then do your branching based on that.