RectTransformUtility.ScreenPointToRay

Declaration

public static Ray ScreenPointToRay(Camera cam, Vector2 screenPos);

Parameters

cam The camera from which the ray originates. (Optional)
screenPos The screen point.

Returns

Ray The ray going from camera through the screen point if the camera is given, or from the screen point going forward if no camera is given.

Description

Transforms a screen space position into a ray.


Did you find this page useful? Please give it a rating: