Serializing functions like it's done for voids with UnityEvent

How do I serialize functions like int Number() or bool True()? In the Inspector it should work like UnityEngine.Events.UnityEvent ( UnityEvent, where have you been all my life? ).

Can’t, really. The UnityEvent works with void because it shoots the event off and doesn’t care about the result, so you can have zero or twenty listeners there and it works fine. The same can’t be true of anything with a return type; it must have exactly one listener, no more no less, or code dependent on it can’t work. So nothing based on UnityEvent would work.

You’d have to roll your own type and the corresponding PropertyDrawer to make this work, which would be an intricate and complex task beyond the scope of a forum post I think.

Probably the closest you could get without a lot of complication would be to use a base class with an abstract function, and derived classes would hold the actual functionality. Then you could drag in an object of one of those derived types and it could return the value you need.