Editar

Partilhar via


EventSystemExtensions.Raycast Method

Definition

Executes a raycast all and returns the closest element. Fixes the current issue with Unity's raycast sorting which does not consider separate canvases.

public static UnityEngine.EventSystems.RaycastResult Raycast (this UnityEngine.EventSystems.EventSystem eventSystem, UnityEngine.EventSystems.PointerEventData pointerEventData, UnityEngine.LayerMask[] layerMasks, Microsoft.MixedReality.Toolkit.Physics.RaycastResultComparer raycastResultComparer = default);
static member Raycast : UnityEngine.EventSystems.EventSystem * UnityEngine.EventSystems.PointerEventData * UnityEngine.LayerMask[] * Microsoft.MixedReality.Toolkit.Physics.RaycastResultComparer -> UnityEngine.EventSystems.RaycastResult
<Extension()>
Public Function Raycast (eventSystem As EventSystem, pointerEventData As PointerEventData, layerMasks As LayerMask(), Optional raycastResultComparer As RaycastResultComparer = Nothing) As RaycastResult

Parameters

eventSystem
UnityEngine.EventSystems.EventSystem
pointerEventData
UnityEngine.EventSystems.PointerEventData
layerMasks
UnityEngine.LayerMask[]
raycastResultComparer
RaycastResultComparer

Returns

UnityEngine.EventSystems.RaycastResult

RaycastResult if hit, or an empty RaycastResult if nothing was hit

Remarks

Takes an optional RaycastResultComparer, which will be used to select the highest priority raycast result.

Applies to