Custom Inspector - Method Selector just like Button OnClick()?

What would be the easiest way to implement a method selector just like the UI Button’s OnClick()? So I can drag in a GameObject, select a script, and a method/variable? Would I have to completely write it from scratch, or is there any sort of helpers?

There is no need for a custom inspector here, you can simply use the UnityEvent class. Note that it is inside the ‘UnityEngine.Events’ namespace, so (in C#) make sure you put ‘using UnityEngine.Events’ at the top.

If you want to use parameter(s), see UnityEvent, UnityEvent<T0,T1> etc.

As for how to use these classes, check the examples in the links.

EDIT:

Forgot to mention, if you use it, but can’t edit it inside the inspector (like in some examples), make sure you make the classes that inherrit from UnityEvent “[Serializable]”. This is what Unity does with the ButtonClickedEvent :wink: