# DistanceToRectangle(Vector3, Quaternion, float)

> Returns the distance in pixels from the mouse pointer to a rectangle on screen.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.3/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public static float DistanceToRectangle(Vector3 position, Quaternion rotation, float size)
```

### Parameters

**** (\[Vector3]\(/engine/6000.3/script-reference/unityengine/vector3)): **** (\[Quaternion]\(/engine/6000.3/script-reference/unityengine/quaternion)): **** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)):&#x20;

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [float](https://learn.microsoft.com/dotnet/api/system.single) |             |

### Remarks

Calculates the screen space distance from the mouse pointer to the rectangle.

Uses the current camera to determine the distance.
