SerializeField BaseEventData ?

Suppose I want to do a similar sort of thing to what EventTrigger class does. I want to allow people to set what function on what object is called, just like that, except I’m not using the existing list of EventTypes.

I haven’t seen any source code for EventTrigger so I can’t see how they specify it. The interface refers to (BaseEventData) but if I try just
[SerializeField]
BaseEventData leftEvent;
This displays nothing in the editor. Is there something else I can do to get that nice “select object and method” thing that the EventTrigger class gets?

BaseEventData is not serializable, so it’s not going to show up in the inspector.

BaseEventData is similar to System.EventArgs. It’s a small chunk of data to go along with some event that occurs in the EventSystem.

What you probably want is UnityEvent:

Here’s a discussion about it:

Personally I use my own version I wrote before UnityEvent was released, it’s the Trigger class in here:

UnityEvent, that does exactly what I’m looking for.