public void RaycastAll(PointerEventData eventData, List <RaycastResult> raycastResults) { // DOC-HINT :::::: multi event system support // check if the eventData passed to the method does not belong to the eventsystem if (!this.CompareEventSystemID(eventData)) { // quit method execution return; } raycastResults.Clear(); var modules = RaycasterManager.GetRaycasters(); for (int i = 0; i < modules.Count; ++i) { var module = modules[i]; if (module == null || !module.IsActive()) { continue; } module.Raycast(eventData, raycastResults); } raycastResults.Sort(s_RaycastComparer); }
public void RaycastAll(PointerEventData eventData, List <RaycastResult> raycastResults) { raycastResults.Clear(); List <BaseRaycaster> raycasters = RaycasterManager.GetRaycasters(); for (int i = 0; i < raycasters.Count; i++) { BaseRaycaster baseRaycaster = raycasters[i]; if (!(baseRaycaster == null) && baseRaycaster.IsActive()) { baseRaycaster.Raycast(eventData, raycastResults); } } raycastResults.Sort(EventSystem.s_RaycastComparer); }
public void RaycastAll(PointerEventData eventData, List <RaycastResult> raycastResults) { raycastResults.Clear(); List <BaseRaycaster> raycasters = RaycasterManager.GetRaycasters(); for (int index = 0; index < raycasters.Count; ++index) { BaseRaycaster baseRaycaster = raycasters[index]; if (!((UnityEngine.Object)baseRaycaster == (UnityEngine.Object)null) && baseRaycaster.IsActive()) { baseRaycaster.Raycast(eventData, raycastResults); } } raycastResults.Sort(EventSystem.s_RaycastComparer); }
public void RaycastAll(PointerEventData eventData, List <RaycastResult> raycastResults) { raycastResults.Clear(); var modules = RaycasterManager.GetRaycasters(); for (int i = 0; i < modules.Count; ++i) { var module = modules[i]; if (module == null || !module.IsActive()) { continue; } module.Raycast(eventData, raycastResults); } raycastResults.Sort(s_RaycastComparer); }
public void RaycastAll(PointerEventData eventData, List <RaycastResult> raycastResults) { raycastResults.Clear(); //获得当前激活状态下每个Canvas上绑定的GraphicRaycaster的对象 var modules = RaycasterManager.GetRaycasters(); for (int i = 0; i < modules.Count; ++i) { var module = modules[i]; if (module == null || !module.IsActive()) { continue; } //开始发送射线 module.Raycast(eventData, raycastResults); } //对发送射线的结果进行排序,保证在前面的UI优先处理 raycastResults.Sort(s_RaycastComparer); }
public void RaycastAll(PointerEventData eventData, List <RaycastResult> raycastResults) { raycastResults.Clear(); // 获取所有的Raycasters,UI中主要是GraphicRaycaster。GraphicRaycaster会在OnEnable中调用RaycasterManager.AddRaycaster进行缓存 // OnDisable中调用RaycasterManager.RemoveRaycasters进行移除 // 因为是获取所有的raycast,因此如果分离出太多的canvas并且都能进行射线检测的话,那么也需要考虑到性能的消耗。 var modules = RaycasterManager.GetRaycasters(); for (int i = 0; i < modules.Count; ++i) { var module = modules[i]; if (module == null || !module.IsActive()) { continue; } // 这里的module一般都是GraphicRaycaster module.Raycast(eventData, raycastResults); } raycastResults.Sort(s_RaycastComparer); }
protected override void OnDisable() { RaycasterManager.RemoveRaycasters(this); base.OnDisable(); }
protected override void OnEnable() { base.OnEnable(); RaycasterManager.AddRaycaster(this); }