Table of Contents

Class VelvetStyleUtilities

Namespace
Velvet
Assembly
Velvet.Docs.dll

Resolves and attaches Velvet's bundled utility stylesheet from runtime code, in the editor and in a player alike. Every utility the sheet declares resolves to nothing on a panel that does not carry it, while arbitrary values and the many families Velvet resolves itself rather than declaring are unaffected — which is why a missing sheet reads as a partial styling bug.

Documentation~/setup.md owns when to call this, which utilities sit on which side of that split (with the command that answers it for any one class), and the alternative of referencing the asset from a scene instead.

public static class VelvetStyleUtilities
Inheritance
object
VelvetStyleUtilities

Fields

DarkThemeClass

The class the sheet keys its dark token set on. Public so an application that sets the class from its own code — a UXML root, a scene hierarchy — names the same one the sheet declares.

Properties

Sheet

The bundled utility stylesheet. Loads on first access and is held for the lifetime of the domain.

Methods

AttachTo(VisualElement)

Adds Sheet to root's UnityEngine.UIElements.VisualElement.styleSheets. Attach before mounting a tree, and to the element whose subtree needs the utilities — a panel root covers everything under it. Attaching twice is harmless.

BindThemeTo(VisualElement)

Keeps root carrying the DarkThemeClass class exactly while IsDark holds, which is what selects the sheet's dark token set for root's subtree. AttachTo(VisualElement) calls this; a project that reaches the sheet from a scene reference instead calls it itself. Binding one element twice is harmless.