- Home /
EventTrigger / EventListener (what's the difference?)
Hi guys,
I'm actually working a lot with UI-Elements but never really tried to understand the EventSystem a Canvas brings with it by default. I think I nailed it down to a point it makes sense to me: The EventSystem component gathers Events from defined InputModules and the GraphicsRaycaster and sends "EventMessages" to UI-GameObjects which are affected by Events. Correct me if I'm wrong - I actually never read about "EventMessages" but it makes sense to me that way... ;)
Now: If the receiving GameObject has a script on it which implements the matching interface for the Event and has the necessary functions defined (what for me means it has an EventListener) it receives the EvenMessage and does what ever is defined in the implemented function (ie. OnPointerEnter). Now you have EventTriggers on the "other side". As far as I understand an EventTrigger component is nothing else than something that could substitute adding and setting up EventListeners by hand. An EventTrigger implements the interface, has the methods defined and you can add the function to call via the Inspector.
Is this correct halfway through? ;)
Best regards mat
Your answer
Follow this Question
Related Questions
Correct way to send an event to a specific enemy 0 Answers
Setting up EventTrigger programmatically for GameObject throws NullReferenceException 0 Answers
EventSystem lag on first touch 0 Answers
EventSystem: prefabs that aren't in the scene don't accept GameObject 0 Answers
How do I have an event be triggered on an audio clip finishing playing? 1 Answer