# RectangleContainsScreenPoint

> Does the RectTransform contain the screen point?

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.UIModule

## RectangleContainsScreenPoint(RectTransform, Vector2)

Does the RectTransform contain the screen point?

```csharp
public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint)
```

### Parameters

**** (\[RectTransform]\(/engine/6000.7/script-reference/unityengine/recttransform)): The RectTransform to test with.**** (\[Vector2]\(/engine/6000.7/script-reference/unityengine/vector2)): The screen point to test.

### Returns

| Type                                                          | Description                                                                                                                                                                         |
| ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the point is inside the rectangle. False if Canvas is set to [RenderMode.ScreenSpaceOverlay](/engine/6000.7/script-reference/unityengine/rendermode/screenspaceoverlay.md). |

## RectangleContainsScreenPoint(RectTransform, Vector2, Camera)

Does the RectTransform contain the screen point as seen from the given camera?

```csharp
public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint, Camera cam)
```

### Parameters

**** (\[RectTransform]\(/engine/6000.7/script-reference/unityengine/recttransform)): The RectTransform to test with.**** (\[Vector2]\(/engine/6000.7/script-reference/unityengine/vector2)): The screen point to test.**** (\[Camera]\(/engine/6000.7/script-reference/unityengine/camera)): The camera from which the test is performed from. (Optional)

### Returns

| Type                                                          | Description                                |
| ------------------------------------------------------------- | ------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True 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?

```csharp
public static bool RectangleContainsScreenPoint(RectTransform rect, Vector2 screenPoint, Camera cam, Vector4 offset)
```

### Parameters

**** (\[RectTransform]\(/engine/6000.7/script-reference/unityengine/recttransform)): The RectTransform to test with.**** (\[Vector2]\(/engine/6000.7/script-reference/unityengine/vector2)): The screen point to test.**** (\[Camera]\(/engine/6000.7/script-reference/unityengine/camera)): The camera from which the test is performed from. (Optional)**** (\[Vector4]\(/engine/6000.7/script-reference/unityengine/vector4)): The offset to apply to the RectTransform.

### Returns

| Type                                                          | Description                                |
| ------------------------------------------------------------- | ------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the point is inside the rectangle. |
