How to get a callback when a button is pressed? Without using getButtonDown in Update()

I understand that I can get the state of the button press using GetButtonDown/Up and the like as per the Unity script manual and stick it in an Update(). However, this solution seems very inefficient because every frame it is executing code to check if the button is pressed or not.

Ideally, an event should be fired when a button is pressed and all I would need to do is to listen to that event and execute my code accordingly.

Does anyone know if this is possible in Unity? if so, how?

It is not possible unless you abstract out the functionality you’re talking about into events you declare yourself, which is easier to use, but won’t do anything to aid performance. This is standard procedure with Unity; there are tons of “Messages” for which a MonoBehaviour can implement code.

Also, I’ve been learning to use NGUI and it has a listener class with so called Delegates. I am at the bottom of a complicated mountain, looking up, but this NGUI feature seemed similar to your concept of efficient. I wish I understood it better and why/when I would use it.