UI Button OnMouseDown

This is a question about the currently in beta new UI, NOT the unity GUI.

I’m currently able to register onClicks by doing:

   button.onClick.AddListener(() => { OnClick(); });

Is there anything similar or anything else to register any onDown events?

Fixed it by creating a wrapper for the OnPointerDown function, for those who care how:

public class UIInput : MonoBehaviour, IPointerDownHandler
{
    public List<Action<PointerEventData>> OnMouseDownListeners = new List<Action<PointerEventData>>();

    public void OnPointerDown(PointerEventData eventData)
    {
        foreach (var callback in OnMouseDownListeners)
        {
            callback(eventData);
        }
    }
    
    public void AddOnMouseDownListener(Action<PointerEventData> action)
    {
        OnMouseDownListeners.Add(action);
    }
}

Attach this script to the UI element and you’re good to go.

I solved it this way:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.EventSystems;

public class AvailableTrayItem : MonoBehaviour, ISelectHandler {

	public void OnSelect (BaseEventData eventData) 
	{
		Debug.Log (this.gameObject.name + " was selected");
	}
}

public class AvailableTray : MonoBehaviour {

        public GameObject prefabButton;

	void Start(){
		addButton();
	}

	void addButton(){
		GameObject gameButton = GameObject.Instantiate( prefabButton );
		gameButton.AddComponent<AvailableTrayItem>();
        }
}