Game Development Reference
In-Depth Information
1.
The Event System itself : At the start of the loop, the Event System verifies it
has the details of all the active input systems present in your scene and then
kicks off the next stage to test those inputs.
2.
Scanner on the scent : Once the manager knows what types of input are
available (such as mouse, keyboard, touch, and so on), it tells each input
system in turn to gather their current state.
3.
Casting out the net : When each input system has its state, they call back
to the Event System to begin raycasting into the scene using the available
raycast systems (Physics raycasters, Graphic raycasters, and so on) to
determine if any GameObjects were interacted with by the user's input.
This then causes the relevant events to be fired informing the relevant
GameObjects. (Remember, this affects any GameObject, not just UI. If you
only want input to affect UI you have to ensure the Canvas blocks raycasts
into the scene using a CanvasGroup .)
4. The final frontier : Once the Event System has finished processing, rendering
takes place and the Canvas draws itself into the scene. This is quite efficient
and ensures any user interactions have been dealt with before the drawing
takes place (such as a Button highlighting from the user's mouse hovering
over it).
5.
Back to The EventSystem itself: And the dance begins again :
Obviously, when you finish the dance you start all over again, once Unity
has finished whatever else it needs to do. You know all the other 3D/2D
rendering and such.
Controlling state
In its other roles (because it is the only one), the EventSystem ensures what the
current state of play is in whatever it does, whether that's:
• Which input system is being tested
• What is currently selected (important for the UI navigation system), including
what the first (the default object) and previously selected objects were
These are key states that need to be tracked at all times through the game loop,
understanding what is being processed at this point in time.
 
Search WWH ::




Custom Search