Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

VisualElementCaptureExtensions.TryCaptureIntoRenderTexture

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static bool TryCaptureIntoRenderTexture(VisualElement element, RenderTexture destination);

Parameters

Parameter Description
element The element to capture.
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. On platforms without CopyTextureSupport.Basic, the capture falls back to a blit that scales the element across the destination, so the result may be stretched and is not offset within a larger destination.

Returns

bool Returns true if the capture succeeded. Returns false if is not attached to a panel, or if the element's panel cannot be captured because it draws directly into cameras.

Description

Renders the element's panel and captures the visual content of into the supplied . Returns false when the element cannot be captured.

This method repaints the whole panel before it captures content. It returns false at runtime if capturing content is not possible, for example, if the element is not attached to a panel, or if the element's panel draws directly into cameras.