Legacy Documentation: Version 5.2
Supported Events
Event System Manager

Raycasters

The Event System needs a method for detecting where current input events need to be sent to, and this is provided by the Raycasters. Given a screen space position they will collect all potential targets, figure out if they are under the given position, and then return the object that is closest to the screen. There are a few types of Raycasters that are provided:

  • Graphic Raycaster - Used for UI elements, lives on a Canvas and searches within the canvas
  • Physics 2D Raycaster - Used for 2D physics elements
  • Physics Raycaster - Used for 3D physics elements

When a Raycaster is present and enabled in the scene it will be used by the Event System whenever a query is issued from an Input Module.

If multiple Raycasters are used then they will all have casting happen against them and the results will be sorted based on distance to the elements.

Supported Events
Event System Manager
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961