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.

C#
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);

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

Ürün Sürümler
MRTK2 Unity 2018 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.7.0
MRTK2 Unity 2019 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.7.0, 2.8.0
MRTK2 Unity 2020 2.5.2, 2.5.3, 2.5.4, 2.6.0, 2.7.0, 2.8.0