How to do a "custom" callback ? (like OnMouseEnter())

Hello there !

I work in C# and I want to implement a custom callback for pointer events, so that it works for any camera, any kind of object, any king of devices (both Touch and Mouse). What I’m having problem with is not the logic itself. I implemented an observer pattern using an interface for objects supposed to receive those events (with methods like OnPointingDeviceEnter, OnPointingDeviceExit …)

But it’s quite boring to ask the user to implement each of those method even though he might want to use only one of those. Plus, I would like to keep it simple for the user, so I’d prefer not to require him to register delegates for each events.

Is there a way not to use any of the aforementioned methods ? How are MonoBehaviour callbacks implemented since users don’t even have to override Update(), Start(), … ?

Thanks in advance for your answers !

Effectively they are done like “SendMessage” though faster.

My article here: unitygems.com - unitygems Resources and Information. covers something that lets you do a faster version that uses reflection only on configuration and after is pretty much the same speed as a normal method call, no need for implementation of interfaces etc.

Sure, just use SendMessage or BroadcastMessage.

I did it this way. No messages or broadcasts needed.
http://forum.unity3d.com/threads/how-to-select-a-callback-function-for-your-script-from-the-editor.295550/