# PixelsToPoints

> Convert a Rect from pixel space to point space.

## Definition

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

## PixelsToPoints(Rect)

Convert a Rect from pixel space to point space.

```csharp
public static Rect PixelsToPoints(Rect rect)
```

### Parameters

**** (\[Rect]\(/engine/6000.6/script-reference/unityengine/rect)): A GUI rect measured in pixels.

### Returns

| Type                                                        | Description                                  |
| ----------------------------------------------------------- | -------------------------------------------- |
| [Rect](/engine/6000.6/script-reference/unityengine/rect.md) | A rect representing the same area in points. |

### Remarks

Convert from pixel space to point space.

Use this to convert values from custom content for use in GUI. For instance, you might be rendering a camera to a render texture, and then drawing GUI on top of that. Screen positions from the camera will be in pixel space, and need to be converted to points before being used for your UI.

Additional Resources: [EditorGUIUtility.PointsToPixels](/engine/6000.6/script-reference/unityeditor/editorguiutility/pointstopixels.md), [EditorGUIUtility.pixelsPerPoint](/engine/6000.6/script-reference/unityeditor/editorguiutility/pixelsperpoint.md).

## PixelsToPoints(Vector2)

Convert a position from pixel to point space.

```csharp
public static Vector2 PixelsToPoints(Vector2 position)
```

### Parameters

**** (\[Vector2]\(/engine/6000.6/script-reference/unityengine/vector2)): A GUI position in pixel space.

### Returns

| Type                                                              | Description                                             |
| ----------------------------------------------------------------- | ------------------------------------------------------- |
| [Vector2](/engine/6000.6/script-reference/unityengine/vector2.md) | A vector representing the same position in point space. |

## PixelsToPoints(Vector2, float)

Convert from pixel space to point space.

```csharp
public static Vector2 PixelsToPoints(Vector2 position, float scaling)
```

### Parameters

**** (\[Vector2]\(/engine/6000.6/script-reference/unityengine/vector2)): **** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)):&#x20;

### Returns

| Type                                                              | Description |
| ----------------------------------------------------------------- | ----------- |
| [Vector2](/engine/6000.6/script-reference/unityengine/vector2.md) |             |

### Remarks

Use this to convert values from custom content for use in GUI. For instance, you might be rendering a camera to a render texture, and then drawing GUI on top of that. Screen positions from the camera will be in pixel space, and need to be converted to points before being used for your UI.

Additional Resources: [EditorGUIUtility.PointsToPixels](/engine/6000.6/script-reference/unityeditor/editorguiutility/pointstopixels.md), [EditorGUIUtility.pixelsPerPoint](/engine/6000.6/script-reference/unityeditor/editorguiutility/pixelsperpoint.md).
