NGUI Button Click Callback from external script.

I simply do not have the option to check if the button is clicked, was clicked, or being clicking using OnClick function within a MonoBehaviour attached to a button, instead I need something like buttonComponent button = GameObject.Find(“button”).GetComponent();

if(button.pressed) {
BUTTON WAS PRESSED… CLICKED… SAME THIng
}

maybe those are not the right class names for NGUI but I never actually used it, just looking online for tutorials before I purchase it are not telling me if thats possible or not, and I simply dont wanna inest $90 for a GUI Tool that wont even do something as simple as that… :{

I found a tutorial that lets me do something like button.text = “… NEW TEXT”;

so surely it has some kind of boolean to check if its pressed or being clicked

You would just write your own handler for that - I do something similar for events that are fired when a button is pressed (which is not normal NGUI either).

var isPressed = false;

function OnPress(pressed : boolean) {
      isPressed = pressed;
}

Or in my case (C#):

   public event Action Clicked = delegate {};

   void OnClick() {
       Clicked();
   }

If you attach the same script to all your buttons then just do something like this…

void OnClick()
{
	string button = gameObject.name;
	switch(button)
	{
		case "Button Name":
		    if(Debug.isDebugBuild) Debug.Log("My Button was Clicked");
			break;
	}
}

Create a new case for each button you haves name and it will trigger each independently.