Documentation

Unity Engine

Download Unity

Unity Engine

CaptureIntoRenderTexture(VisualElement, RenderTexture)

Renders the element's panel and captures the visual content of element into the supplied destination.
Read time 1 minuteLast updated 20 days ago

Definition

public static void CaptureIntoRenderTexture(this VisualElement element, RenderTexture destination)

Parameters

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

destination

The texture to render into. The caller owns and is responsible for releasing it. The element is captured at the panel's scale and aligned to the top-left of the texture. Content that does not fit is cropped, and any uncovered region is left transparent.

Remarks

This method repaints the whole panel before it captures content. Use VisualElementCaptureExtensions.TryCaptureIntoRenderTexture when you expect the panel is missing or draws into cameras.