i want to get the UI button on which the mouse is clicked?

I NEED THE SCRIPT IN SUCH A MANNER THAT IF U CLICK ON THE “ANY BUTTON” IN UNITY, THE BUTTON IS STORED IN THE VARIABLE:

public Button TEMP_BUTTON;

                     WHICH IS IN THE SAME SCRIPT.

Maybe try explaining your problem a little better next time… and not use all caps.

I think I understand what you’re asking. You could use an OnClick() function and change the variable based on which button you click.

	public string buttonClicked;
	
	void OnClick() {

		buttonClicked = "Button1";


		}

And in a different script get the value for buttonClicked and use an if statement to see which button was clicked.

if(buttonClicked == "Button1")
    			print("Do something");
    
    		else if(buttonClicked == "Button2")
    			print ("Do Something Else");
    
    		//ect.....
    
    		else
    			print ("Do Nothing");
    
    	}

I think that’s what you’re asking for, but it’s somewhat unclear.

i got my own answer thanks for commenting

**public Button Temp_Button;

public void On_Click_Button(Text T)
{

	Temp_Button = T.GetComponentInParent<Button> ();
    }**

  Text T is Assigned in On_click event trigger in unity, 
  as every button has a text. Text is dragged to the script trigger

public Button TEMP_BUTTON;

//Call this method from Buttons you want to save.
//Pass those buttons as parameter.
void SaveButtonClicked( Button button)
{
     TEMP_BUTTON = button;
}