先看几个概念
BaseRaycaster :UIBehaviour 用来发射线 射线的发送是用EventSystem::RaycastAll
GraphicRaycaster 需要 Canvas
BlockingObjects TwoD或者ThreeD,那么还会在此之前发物理射线判断距离PhysicsRaycast 需要 CameraPhysics2DRaycast 需要 CameraBaseInput:UIBehaviour
BaseInputModule用,作EventSystem:UIBehaviour 发射射线是用BaseInputModule::GetMousePointerEventData->eventSystem::RaycastAll
BaseInputModule进行TickBaseInputModule:UIBehaviour 需要 EventSystem 是在Process中让EventSystem发射射线在Update中,检测鼠标是否按下,如果按下,就进行射线检测。
找到所有之前注册进来的BaseRayCaster,把鼠标相关信息传过去,让他们进行射线检测,把结果添加到集合中。
集合进行排序,目的是找到最前方的射线结果。排序方法包括检查射线摄像机的depth,BaseRayCaster的sortOrderPriority和renderOrderPriority,检查射线结果的SortingOrder和OrderInLayer,depth和distance等。
把射线结果传过去,Execute的时候冒泡触发,往上找到第一个能触发的就触发并且结束。