[4.6 UI] Button onSelect

I feel like I’m overlooking something really obvious, but I’m instantiating buttons at runtime, how do I use their onSelect function in a script?

Given how new the system is, I’m surprised I found nothing on google except for this:
I have placed the function

public void OnSelect(BaseEventData eventData)
	{
		Debug.Log("test");
	}

in both my UIManager script, and a script attached to the button’s gameobject. It isn’t being called. All I want to do right now is log text when the button goes to the state selected.

Thanks!

You also need to declare that you are using it:

public class YourClassName : MonoBehaviour, ISelectHandler
{
…