The Event System
In Chapter 6, we learned that when the first Canvas is added to a scene, a GameObject named EventSystem
is automatically added to the Hierarchy. The Event System allows you to easily receive player interactions and send those interactions to objects in your scene through events. Note that I said, objects in your scene and not UI objects. The Event System allows you to send events to non-UI items, too!
Before we proceed, I’d like to note my use of EventSystem
(one word) and Event System (two words), because I will be switching back and forth between the two. I want you to know that I am doing it deliberately and am not just randomly deciding that sometimes I hate the spacebar.
I will use EventSystem
(one word) to reference the actual GameObject that appears in the Hierarchy of your scene and Event System (two words) to reference the system that handles events.
The Event System does quite a few things for you other than just sending events to objects...