Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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.
Read time 1 minuteLast updated 14 days ago

Definition

public static RenderTexture CaptureToRenderTexture(this VisualElement element)

Parameters

The element to capture. It must belong to a panel.

Returns

Type

Description

RenderTextureA new RenderTexture scaled according to the panel. The caller owns the returned texture and is responsible for releasing it with RenderTexture.Release.

Remarks

This method repaints the whole panel before it captures content.