New 4.6 UI: Need to know sender of a button click event

In the editor, I can bind a script function to a new UI Button’s onClick event, but when it is called, no information is passed about which object was clicked. If I have a dynamic list of buttons and they all use the same event handler, I won’t know which one was clicked.

I see some BaseEventData has a selectedObject property, but I’m not sure if that’s what I’m looking for, and I don’t get an instance of BaseEventData in an onClick handler anyway.

What’s a good way to get this information?

Just a workaround…

you can attach a script to the button such as…

public void OnbtnClick()
		Text txtBtnClicked= gameObject.GetComponentInChildren<Text>();
		Debug.Log("ID of the button clicked is " + txtBtnClicked.text);	

Add this method to the onclick event of your button