TryCaptureIntoRenderTexture(VisualElement, RenderTexture)
Renders the element's panel and captures the visual content of element into the supplied destination. Returns false when the element cannot be captured.
Read time 1 minuteLast updated 12 days ago
Definition
- Type: Method
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
public static bool TryCaptureIntoRenderTexture(this VisualElement element, RenderTexture destination)
Parameters
The element to capture.
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
Type | Description |
|---|---|
| bool | Returns |
Remarks
This method repaints the whole panel before it captures content. It returns 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.
false