Game Development Reference
In-Depth Information
Unravelling the Event System
The
EventSystem
is a powerful yet simple manager providing such capabilities as:
• Cataloging all the input systems available
• Monitoring the current input state
• Maintaining the currently selected GameObject
• Updating all the various input systems
• Marshalling Raycast testing between input and screen objects (and not just
UI GameObjects!)
We'll discuss what these mean in detail, shortly.
It's worth noting, there can only ever be a single
EventSystem
manager
in any scene, no matter how many you try to add. At the core of the
EventSystem
is a static instance that ensures there can be only one.
The
EventSystem
uses all the Event logic described in the following sections of this
chapter and manages the state of the UI and even processes the events for selected
objects (as described previously).
The Event System loop
Like most managers and Unity itself, the
EventSystem
runs on a loop that looks like
the following: