Game Development Reference
In-Depth Information
Raycast Marshalling
The EventSystem is also the go-to manager for raycast testing. As ever, all roads lead
back to the EventSystem .
When an input module needs to verify if something needs to be notified by a
specific input interaction, it asks the EventSystem if anything is in the vicinity of the
current coordinates for the input action (mouse pointer or touch). The EventSystem
then takes this position and then loops through all the raycast modules you have
registered on your Canvas to see if anything was hit. The currently supported
raycast modules are:
Physics Raycaster : Tests 3D objects within the scene
Physics 2D Raycaster : Tests 2D objects within the scene
Graphics Raycaster : Test UI objects within the scene
Another Raycaster : Build your own raycast test component!
These tests simply return a set of raycast results (if anything was interacted with by
each progressive raycast test) for the input manager to handle.
If you are unfamiliar with Raycasting, check out the Unity documentation
at http://unity3d.com/learn/tutorials/modules/beginner/
physics/raycasting .
Basically, Raycasting is a simple test that takes one coordinate (say the
position of a mouse) and a second coordinate (usually dynamically
created through the scene using the camera) and tests to see if anything
lies between those two points; if anything is hit, this results in a Raycast
hit with relevant data about what it was.
Working with events
Behind the new UI system is the introduction of a new UnityEvent logic that is
intended to standardize and delegate managed interactions between GameObjects
in a scene; primarily, it focuses the input interactions with the new UI but it doesn't
have to stop there.
At the core of the new UI system there is a new type of delegate manager called the
UnityEvent . This manager allows you to create, add, and remove multiple delegate
functions to it and execute them all at once.
 
Search WWH ::




Custom Search