Event Trigger
The Event Trigger component can be attached to any UI (or non-UI) element to allow the object to receive events. Some of the UI elements are preconfigured to intercept specific events. For example, buttons have the onClick
event. However, if you’d like to add an event to an object that either isn’t already set up to receive events or you want it to receive different events, you can attach an Event Trigger component to the GameObject.
You can attach an Event Trigger component by selecting Add Component | Event | Event Trigger.
One caveat of using the Event Trigger component is that the object it is attached to receives all the events, not just the ones you added. So, even if you don’t tell the object what to do with the specified event, it will receive that event and acknowledge that the event occurred—it just won’t do anything in response. This can slow the performance of your game. If you are worried about performance, you will...