Is there a built-in function to determine if any GUI item has been clicked?

What I need to figure out if there is a built-in method to determine if any GUI item has been clicked. For instance, I have a button in the HUD that you can click to open a status menu, but I’d like to be able to restrain other areas from acting on this click, such as the character firing their weapon, by making a call to the supposed built-in function to check for this click. Now, I know I could throw some sort of method within the block of code that handles button clicks to flag some boolean, but I would like to lean towards built-in methods if at all possible. So, to iterate, is there a built-in function to determine if any GUI item has been clicked?

You might be able to whip up something assigning GUI.tooltip (you dont have to actually display the tooltip) to the button in question and checking if its null where you fire a weapon, but there must be a better way to do this

enter code hereDid you look at the Event class in Unity?

var button : int
Description: Which mouse button was pressed.

0 means left mouse button, 1 means right mouse button, 2 means middle mouse button.
Used in EventType.MouseDown, EventType.MouseUp events.

You could maybe use this with

Rect customRect;
// Custom rectangle for the GUI area that you want clickable
void Start () {
	customRect.x = 200;
	customRect.y = 200;
	customRect.width = 200;
	customRect.height = 200;


void OnGUI()

            // Check if mouse coordinates are in the rectangle
	if (customRect.Contains(Event.current.mousePosition))
		Event e = Event.current;

                    // Mouse is in the rectangle so check for clicks
		if (e.button == 0 && e.isMouse){ Debug.Log("Left Click"); }
		else if (e.button == 1) { Debug.Log("Right Click");}
		else if (e.button == 2){ Debug.Log("Middle Click"); }
		else if (e.button > 2){ Debug.Log("Another button in the mouse clicked"); }