Class BaseRaycaster
Base class for any RayCaster.
Inherited Members
Namespace: UnityEngine.EventSystems
Assembly: UnityEngine.UI.dll
Syntax
public abstract class BaseRaycaster : UIBehaviour
Remarks
A Raycaster is responsible for raycasting against scene elements to determine if the cursor is over them. Default Raycasters include PhysicsRaycaster, Physics2DRaycaster, GraphicRaycaster. Custom raycasters can be added by extending this class.
Properties
eventCamera
The camera that will generate rays for this raycaster.
Declaration
public abstract Camera eventCamera { get; }
Property Value
| Type | Description |
|---|---|
| Camera |
renderOrderPriority
Priority of the raycaster based upon render order.
Declaration
public virtual int renderOrderPriority { get; }
Property Value
| Type | Description |
|---|---|
| int |
rootRaycaster
Raycaster on root canvas
Declaration
public BaseRaycaster rootRaycaster { get; }
Property Value
| Type | Description |
|---|---|
| BaseRaycaster |
sortOrderPriority
Priority of the raycaster based upon sort order.
Declaration
public virtual int sortOrderPriority { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
OnCanvasHierarchyChanged()
Clears the cached root raycaster, because the canvas hierarchy might have changed which raycaster is the root one.
Declaration
protected override void OnCanvasHierarchyChanged()
Overrides
OnDisable()
Unregisters this raycaster so that the EventSystem stops raycasting with it.
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Registers this raycaster so that the EventSystem raycasts with it.
Declaration
protected override void OnEnable()
Overrides
OnTransformParentChanged()
Clears the cached root raycaster, because the new parent might have a different root raycaster.
Declaration
protected override void OnTransformParentChanged()
Overrides
Raycast(PointerEventData, List<RaycastResult>)
Raycast against the scene.
Declaration
public abstract void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
Parameters
| Type | Name | Description |
|---|---|---|
| PointerEventData | eventData | Current event data. |
| List<RaycastResult> | resultAppendList | List of hit Objects. |
ToString()
Returns a multi-line string that lists the event camera and the priorities of this raycaster.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The formatted description of the raycaster. |