Class PhysicsRaycaster
Simple event system using physics raycasts.
Inheritance
Inherited Members
Namespace: UnityEngine.EventSystems
Syntax
[AddComponentMenu("Event/Physics Raycaster")]
[RequireComponent(typeof(Camera))]
public class PhysicsRaycaster : BaseRaycaster
Constructors
PhysicsRaycaster()
Declaration
protected PhysicsRaycaster()
Fields
kNoEventMaskSet
Const to use for clarity when no event mask is set
Declaration
protected const int kNoEventMaskSet = -1
Field Value
Type | Description |
---|---|
Int32 |
m_EventCamera
Declaration
protected Camera m_EventCamera
Field Value
Type | Description |
---|---|
Camera |
m_EventMask
Layer mask used to filter events. Always combined with the camera's culling mask if a camera is used.
Declaration
[SerializeField]
protected LayerMask m_EventMask
Field Value
Type | Description |
---|---|
LayerMask |
m_LastMaxRayIntersections
Declaration
protected int m_LastMaxRayIntersections
Field Value
Type | Description |
---|---|
Int32 |
m_MaxRayIntersections
The max number of intersections allowed. 0 = allocating version anything else is non alloc.
Declaration
[SerializeField]
protected int m_MaxRayIntersections
Field Value
Type | Description |
---|---|
Int32 |
Properties
depth
Depth used to determine the order of event processing.
Declaration
public virtual int depth { get; }
Property Value
Type | Description |
---|---|
Int32 |
eventCamera
Declaration
public override Camera eventCamera { get; }
Property Value
Type | Description |
---|---|
Camera |
Overrides
eventMask
Layer mask used to filter events. Always combined with the camera's culling mask if a camera is used.
Declaration
public LayerMask eventMask { get; set; }
Property Value
Type | Description |
---|---|
LayerMask |
finalEventMask
Event mask used to determine which objects will receive events.
Declaration
public int finalEventMask { get; }
Property Value
Type | Description |
---|---|
Int32 |
maxRayIntersections
Max number of ray intersection allowed to be found.
Declaration
public int maxRayIntersections { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
A value of zero will represent using the allocating version of the raycast function where as any other value will use the non allocating version.
Methods
ComputeRayAndDistance(PointerEventData, ref Ray, ref Int32, ref Single)
Returns a ray going from camera through the event position and the distance between the near and far clipping planes along that ray.
Declaration
protected bool ComputeRayAndDistance(PointerEventData eventData, ref Ray ray, ref int eventDisplayIndex, ref float distanceToClipPlane)
Parameters
Type | Name | Description |
---|---|---|
PointerEventData | eventData | The pointer event for which we will cast a ray. |
Ray | ray | The ray to use. |
Int32 | eventDisplayIndex | The display index used. |
Single | distanceToClipPlane | The distance between the near and far clipping planes along the ray. |
Returns
Type | Description |
---|---|
Boolean | True if the operation was successful. false if it was not possible to compute, such as the eventPosition being outside of the view. |
Raycast(PointerEventData, List<RaycastResult>)
Declaration
public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
Parameters
Type | Name | Description |
---|---|---|
PointerEventData | eventData | |
List<RaycastResult> | resultAppendList |