文档

Unity Engine

Unity Engine

RectangleContainsScreenPoint

Does the RectTransform contain the screen point?
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.UIModule

RectangleContainsScreenPoint(RectTransform, Vector2)

Does the RectTransform contain the screen point?
public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint)

Parameters

The RectTransform to test with.

screenPoint

The screen point to test.

Returns

Type

Description

boolTrue if the point is inside the rectangle.

RectangleContainsScreenPoint(RectTransform, Vector2, Camera)

Does the RectTransform contain the screen point as seen from the given camera?
public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint, Camera cam)

Parameters

The RectTransform to test with.

screenPoint

The screen point to test.

The camera from which the test is performed from. (Optional)

Returns

Type

Description

boolTrue if the point is inside the rectangle.

RectangleContainsScreenPoint(RectTransform, Vector2, Camera, Vector4)

Does the RectTransform, with the given offset, contain the screen point as seen from the given camera?
public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint, Camera cam, Vector4 offset)

Parameters

The RectTransform to test with.

screenPoint

The screen point to test.

The camera from which the test is performed from. (Optional)

offset

The offset to apply to the RectTransform.

Returns

Type

Description

boolTrue if the point is inside the rectangle.