Table of Contents

Method SceneView

Namespace
Velvet
Assembly
Velvet.Docs.dll

SceneView(Camera?, string?, string?, string?, float, StyleOverrides?, Func<VisualElement, Action>?, string?, string?, string?, IReadOnlyDictionary<string, string>?, IReadOnlyDictionary<string, string>?)

Creates a SceneView element displaying camera's output — the canvas-parity element. The framework owns the RenderTexture: it is created at the element's laid-out pixel size (times resolutionScale), resized when the element's geometry changes, assigned to camera.targetTexture while mounted, and released on unmount (restoring the camera's target only if it is still the framework's own texture). The output arrives through the element's background image, so background utilities and rounded corners apply to it.

public static ElementNode SceneView(Camera? camera, string? className = null, string? key = null, string? name = null, float resolutionScale = 1, StyleOverrides? styles = null, Func<VisualElement, Action>? refCallback = null, string? whileHoverClass = null, string? whileTapClass = null, string? whileFocusClass = null, IReadOnlyDictionary<string, string>? data = null, IReadOnlyDictionary<string, string>? aria = null)

Parameters

camera Camera

Camera whose output the element displays. Null renders nothing (the element mounts as an empty box until a camera is supplied).

className string

CSS-like utility class string. Multiple classes separated by spaces.

key string

Key used to disambiguate siblings at the same position.

name string

Element name assigned to UnityEngine.UIElements.VisualElement.name for query/debug.

resolutionScale float

Render-resolution multiplier over the element's laid-out pixel size (0.5 renders at half resolution).

styles StyleOverrides

Inline style overrides applied on top of USS classes.

refCallback Func<VisualElement, Action>

Callback invoked on mount with the created VisualElement; returned Action runs on unmount.

whileHoverClass string

USS class toggled while the pointer hovers the element (gesture-driven).

whileTapClass string

USS class toggled while the pointer is pressed on the element (gesture-driven).

whileFocusClass string

USS class toggled while the element holds keyboard/UI focus (gesture-driven).

data IReadOnlyDictionary<string, string>

data-* attribute map matched by data-[...] variants.

aria IReadOnlyDictionary<string, string>

aria-* attribute map matched by aria-[...] variants.

Returns

ElementNode

The created ElementNode representing this scene view.

Exceptions

ArgumentOutOfRangeException

resolutionScale is <= 0 or NaN.