# DrawCamera

> Draws a camera inside a rectangle.

## Definition

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

## DrawCamera(Rect, Camera)

Draws a camera inside a rectangle.

```csharp
public static void DrawCamera(Rect position, Camera camera)
```

### Parameters

**** (\[Rect]\(/engine/6000.7/script-reference/unityengine/rect)): The area to draw the camera within in GUI coordinates.**** (\[Camera]\(/engine/6000.7/script-reference/unityengine/camera)): The camera to draw.

### Remarks

This function also sets [Camera.current](/engine/6000.7/script-reference/unityengine/camera/current.md) to `camera`. It sets the camera's pixelRect to `position`, but in screen coordinates. This might be different from GUI coordinates if you are using a high DPI display.

**Note:** Use [HandleUtility.GetHandleSize](/engine/6000.7/script-reference/unityeditor/handleutility/gethandlesize.md) where you might want to have constant screen-sized handles.

See Also [EditorGUIUtility.pixelsPerPoint](/engine/6000.7/script-reference/unityeditor/editorguiutility/pixelsperpoint.md).

## DrawCamera(Rect, Camera, DrawCameraMode)

Draws a camera inside a rectangle.

```csharp
public static void DrawCamera(Rect position, Camera camera, DrawCameraMode drawMode)
```

### Parameters

**** (\[Rect]\(/engine/6000.7/script-reference/unityengine/rect)): The area to draw the camera within in GUI coordinates.**** (\[Camera]\(/engine/6000.7/script-reference/unityengine/camera)): The camera to draw.**** (\[DrawCameraMode]\(/engine/6000.7/script-reference/unityeditor/drawcameramode)): How the camera is drawn (textured, wireframe, etc.).

### Remarks

This function also sets [Camera.current](/engine/6000.7/script-reference/unityengine/camera/current.md) to `camera`. It sets the camera's pixelRect to `position`, but in screen coordinates. This might be different from GUI coordinates if you are using a high DPI display.

**Note:** Use [HandleUtility.GetHandleSize](/engine/6000.7/script-reference/unityeditor/handleutility/gethandlesize.md) where you might want to have constant screen-sized handles.

See Also [EditorGUIUtility.pixelsPerPoint](/engine/6000.7/script-reference/unityeditor/editorguiutility/pixelsperpoint.md).

## DrawCamera(Rect, Camera, DrawCameraMode, bool)

Draws a camera inside a rectangle.

```csharp
public static void DrawCamera(Rect position, Camera camera, DrawCameraMode drawMode, bool drawGizmos)
```

### Parameters

**** (\[Rect]\(/engine/6000.7/script-reference/unityengine/rect)): The area to draw the camera within in GUI coordinates.**** (\[Camera]\(/engine/6000.7/script-reference/unityengine/camera)): The camera to draw.**** (\[DrawCameraMode]\(/engine/6000.7/script-reference/unityeditor/drawcameramode)): How the camera is drawn (textured, wireframe, etc).**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)):&#x20;

### Remarks

This function also sets [Camera.current](/engine/6000.7/script-reference/unityengine/camera/current.md) to `camera`. It sets the camera's pixelRect to `position`.

**Note:** Use [HandleUtility.GetHandleSize](/engine/6000.7/script-reference/unityeditor/handleutility/gethandlesize.md) where you might want to have constant screen-sized handles.
