1.EventSystem会在Update中调用所有BaseInputModule的Process
2.在StandaloneInputModule中override Process会调用ProcessTouchEvents函数,ProcessTouchEvents调用GetTouchPointerEventData函数。GetTouchPointerEventData中调用eventSystem.RaycastAll,,在RaycastAll中调用Raycasters集合的GraphicRaycast.Raycast()函数
3.GraphicRaycast组件的override Raycast()将所有graphic.raycastTarget =true的RaycastResult存起来.(里面包含他的所有UI信息)
4.
eventSystem.RaycastAll(pointerData, m_RaycastResultCache);
var raycast = FindFirstRaycast(m_RaycastResultCache);
pointerData.pointerCurrentRaycast = raycast;
m_RaycastResultCache.Clear();
通过FindFirstRaycast这个函数找到第一个触碰到的物件,把pointerData压入其中,然后通过Eventdata分发到对应的响应中。
所以要把raycastTarget选项去掉,这个选项会被一直在Update中遍历。