Edit

Share via


CanvasExtensions.Raycast Method

Definition

Raycast against a canvas using a ray.

public:
[System::Runtime::CompilerServices::Extension]
 static bool Raycast(UnityEngine::Canvas ^ canvas, UnityEngine::Vector3 rayOrigin, UnityEngine::Vector3 rayDirection, [Runtime::InteropServices::Out] float % distance, [Runtime::InteropServices::Out] UnityEngine::Vector3 % hitPoint, [Runtime::InteropServices::Out] UnityEngine::GameObject ^ % hitChildObject);
public static bool Raycast (this UnityEngine.Canvas canvas, UnityEngine.Vector3 rayOrigin, UnityEngine.Vector3 rayDirection, out float distance, out UnityEngine.Vector3 hitPoint, out UnityEngine.GameObject hitChildObject);
static member Raycast : UnityEngine.Canvas * UnityEngine.Vector3 * UnityEngine.Vector3 * single * Vector3 * GameObject -> bool
<Extension()>
Public Function Raycast (canvas As Canvas, rayOrigin As Vector3, rayDirection As Vector3, ByRef distance As Single, ByRef hitPoint As Vector3, ByRef hitChildObject As GameObject) As Boolean

Parameters

canvas
UnityEngine.Canvas

The canvas to raycast against

rayOrigin
UnityEngine.Vector3

The origin of the ray

rayDirection
UnityEngine.Vector3

The direction of the ray

distance
Single

The distance of the ray

hitPoint
UnityEngine.Vector3

The hitpoint of the ray

hitChildObject
UnityEngine.GameObject

The child object that was hit or the canvas itself if it has no active children that were within the hit range.

Returns

Applies to