# CaptureToRenderTexture(VisualElement)

> Renders the element's panel and captures the visual content of element into a new RenderTexture sized to the element's pixel bounds.

## Definition

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

```csharp
public static RenderTexture CaptureToRenderTexture(this VisualElement element)
```

### Parameters

**** (\[VisualElement]\(/engine/6000.7/script-reference/unityengine/uielements/visualelement)): The element to capture. It must belong to a panel.

### Returns

| Type                                                                          | Description                                                                                                                                                                                                                                                                                     |
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [RenderTexture](/engine/6000.7/script-reference/unityengine/rendertexture.md) | A new [RenderTexture](/engine/6000.7/script-reference/unityengine/rendertexture.md) scaled according to the panel. The caller owns the returned texture and is responsible for releasing it with [RenderTexture.Release](/engine/6000.7/script-reference/unityengine/rendertexture/release.md). |

### Remarks

This method repaints the whole panel before it captures content.
