UnityEngine.EventSystems.EventSystem.RaycastAll C# (CSharp) Method

RaycastAll() public method

public RaycastAll ( PointerEventData eventData, List raycastResults ) : void
eventData PointerEventData
raycastResults List
return void
        public void RaycastAll(PointerEventData eventData, List<RaycastResult> raycastResults)
        {
            raycastResults.Clear();
            List<BaseRaycaster> raycasters = RaycasterManager.GetRaycasters();
            for (int i = 0; i < raycasters.Count; i++)
            {
                BaseRaycaster raycaster = raycasters[i];
                if ((raycaster != null) && raycaster.IsActive())
                {
                    raycaster.Raycast(eventData, raycastResults);
                }
            }
            raycastResults.Sort(s_RaycastComparer);
        }

Usage Example

コード例 #1
2
ファイル: ETCBase.cs プロジェクト: YanivP/FriendBubbles
	protected GameObject GetFirstUIElement( Vector2 position){
		
		uiEventSystem = EventSystem.current;
		if (uiEventSystem != null){
			
			uiPointerEventData = new PointerEventData( uiEventSystem);
			uiPointerEventData.position = position;
			
			uiEventSystem.RaycastAll( uiPointerEventData, uiRaycastResultCache);
			if (uiRaycastResultCache.Count>0){
				return uiRaycastResultCache[0].gameObject;
			}
			else{
				return null;
			}
		}
		else{
			return null;
		}
	}
All Usage Examples Of UnityEngine.EventSystems.EventSystem::RaycastAll