Raycasters

When we created the first Canvas for the scene, Unity also added an item called EventSystem. An EventSystem is used to detect where current input events need to be sent and Raycasters provide that information. Think of a Raycaster as a visible laser pointer. When evoked in your scene, the Raycaster sends out a ray which reports the object or objects it has collided with. For our project, we will be using a Graphic Raycaster, but there are also two other types of Raycasters to consider:

  • Graphic Raycaster: Queries all UI elements in a canvas to determine if any item collides with the ray. This type also has a few properties which determine the conditions in which objects can be ignored.
  • Physics 2D Raycaster: Can identify 2D physics elements.
  • Physics Raycaster: For 3D physics elements.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.64.132