How to expose UnityEvent in editor?

if I do this

public UnityEvent myEvent;

it exposes it in the editor nicely. However.

public UnityEvent<float> myFloatEvent;

does not get exposed. It claims in the lacking documentation that I should override this? I dont understand.

I have found the way.

first you have to define your own event type (which is just a basic public class). however the custom event type must inherit from UnityEvent, like so.

[System.Serializable]
public class myFloatEvent : UnityEvent<float>{}

then you can make variables from it, like so.

[SerializeField]
public myFloatEvent onChangeEvent;

then you can set it in the editor

36094-unityanswer.png

and the last step is to actually Invoke it in your custom code, which was the entire purpose of it.

onChangeEvent.Invoke(newValue);