Alternatively, just attach one script to every button object, which examines the button press event against the calling gameobject.name property. Below I use OnPress, but you could use any NGUI event similarly.
For example:
public class GeneralUIButtonHandler : MonoBehaviour {
//
// Simply handles button events and does the appropriate actions
//
void OnPress(bool isDown)
{
// return without doing anything if this is a button up event
if (!isDown) return;
// don't trigger buttons if the mouse click isn't a left mouse button event
if (UICamera.currentTouchID != -1) return;
// do actions based upon the name of the gameobject
if (this.gameObject.name == "Button_1")
{
// do something here
}
else if (this.gameObject.name == "Button_2")
{
// do something else here
}
}
}
Granted, you'd probably not want to use this for dozens and dozens of buttons, but for just a few it'll work just fine and the comparison evaluations shouldn't be much of a hit since it's local object data with a string compare.