INSTRUCTION BOOKLET

UXML PREVIEW

Read Unity UI Toolkit documents without opening the Unity Editor.
VERSION 0.1.0VS CODE 1.90+ UNITY DEVELOPERS
ENGLISH EDITIONVIEWER, NOT EDITOR
ContentsCONTENTS
1What this viewer doesBASICS

UXML Preview renders a .uxml document in a VS Code webview. The extension reads and watches files; the uxml-preview core parses UXML and USS, lays it out with Yoga, and paints the result.

"If the renderer cannot honor something, the panel must say so."THE VIEWER'S CONTRACT

It draws five control types: VisualElement, Label, Button, Image, and ScrollView. Other controls become plain fallback boxes. Template and Instance are not rendered.

SCOPE

This is a viewer. It does not edit files, validate USS, reproduce every UI Toolkit control, or put diagnostics in VS Code's Problems panel.

Commands

CommandWhere it opensShortcut
UXML Preview: Open PreviewCurrent editor columnCommand Palette
UXML Preview: Open Preview to the SideBeside the source documentCtrl+Shift+V
Cmd+Shift+V on macOS

Settings

SettingDefaultMeaning
uxmlPreview.canvas.width1920Fixed root width in pixels.
uxmlPreview.canvas.height1080Fixed root height in pixels.
uxmlPreview.canvas.fitToPanelfalseUse the preview area's current size instead of the fixed size.
uxmlPreview.projectRootemptyUnity project root for project paths and GUID references. Empty uses the workspace folder containing the file.
uxmlPreview.states{}Pseudo-class states keyed by USS selector. This version has no selector input UI.
CANVAS DEFAULT

The fixed 1920 by 1080 canvas is deliberate. A layout with 3 pixels of slack can flip after a 4-pixel size difference. A fixed root gives different readers the same layout input.

2First previewINSTALL

Install UXML Preview from the Visual Studio Marketplace inside VS Code, then open a UXML document. No Unity Editor process is required for the preview.

Open a document, not a stylesheet

OOpen the UXML
Panel.uxml
  <Style src="Panel.uss" />
In Unity UI Toolkit, a stylesheet only takes effect when attached to a document.
XOpen USS alone
Panel.uss
  no document tree to draw
A USS file cannot be rendered on its own.

Install and open

Open Extensions

In VS Code 1.90 or later, open the Extensions view with Ctrl+Shift+X, or Cmd+Shift+X on macOS.

Find the extension

Search for UXML Preview for Unity UI Toolkit in the Visual Studio Marketplace.

Install

Select the extension published by reuhomi and choose Install.

Open the first preview

Open a .uxml file and press Ctrl+Shift+V, or Cmd+Shift+V on macOS. A preview opens beside the editor.

FIRST WIN

If the panel shows a canvas and a diagnostics summary, the extension, webview, and renderer have all started.

3Four concepts to knowCHARACTERS

The controls are simple. These four ideas explain why the picture may differ from Unity and what the viewer is telling you.

STAND-IN
Fallback
PRESENCE 100%
CONTROL BEHAVIOR 0%
"I forgot which control I used to be, but I do not disappear without a trace."
RoleAn unsupported control becomes a plain box and produces an unsupported-control diagnostic.
MetaphorA stage stand-in marks where the missing actor belongs. The metaphor stops at behavior: the box does not recreate the original control.
WatchA zero-height fallback still receives an outline marker; overlapping markers at the same position share a count.
TRIAGE
Diagnostics
INFORMATION KEPT 100%
AUTO-REPAIR 0%
"I group by what you can do next, not by warning kind or severity."
RoleA: Fixable covers file, path, setting, and malformed-input work. B: Waiting for support covers unsupported renderer features. C: Renderer differences from Unity covers version-dependent and known differences.
MetaphorA triage desk sends each item to the person who can act. It is not a severity scale: C is not automatically worse than A.
WatchCore text and host context can share one item. The header counts issues, not the number of displayed lines.
RULER
Canvas
FIXED INPUT 100%
PANEL FOLLOWING 0%
"I stay at 1920 by 1080 until you explicitly ask me to follow the panel."
RoleThe root size is an input to layout. The current size is always shown in the control bar.
MetaphorA fixed ruler lets two readers compare the same measurement. The metaphor stops when Fit to panel is on: the root is re-laid out, not zoomed.
WatchThree pixels of spare room can become a different layout after a four-pixel size change.
ADDRESS
Project root
PATH FIRST 100%
PACKAGE CACHE 0%
"Try the written path first. If an asset moved, its GUID can still lead me to the file."
RoleuxmlPreview.projectRoot anchors Unity project paths. Asset references commonly carry both a path and a GUID; a moved file keeps the GUID in its .meta.
MetaphorAn address book tries the street address, then the stable identity. The metaphor stops at stylesheets: GUID fallback is for assets, not USS imports.
WatchThe GUID index is built only after a path miss and is reused while the panel lives. Library/PackageCache is not searched.
4Symptom to actionNAVI CHART

Read from the top and stop at the first row that matches.

You opened a .uss file.
Open a .uxml that references it.
The panel is magenta and says asset-unresolved.
Check projectRoot, path, and GUID.
A plain outlined box says unsupported-control.
Treat it as unsupported renderer coverage.
The image renders, but A says the written path is stale.
Update the UXML path to the found file.
A newly created missing import is still unresolved.
Reopen the preview to rebuild watches.
The fixed canvas is wider than the panel.
Enable Fit to panel when responsive layout is intended.
Text-dependent geometry differs by a few pixels.
Read group C before treating it as a defect.
5A normal work sessionQUICK PLAY
Open
Select the UXML and open the preview to the side.
Set context
Confirm canvas size, active states, and project root.
Edit and save
Change UXML or a resolved USS file. Saving triggers a rerender.
Read diagnostics
Fix A, note B, and understand C before comparing with Unity.
Compare
Use the displayed root size when checking the same document in Unity.
STATE CHECK

The control bar can apply hover, active, focus, and disabled to every element. Check those boxes before deciding that Unity and the preview disagree.

6Problem solvingTROUBLESHOOTING
Why does nothing open for a USS file?
A USS file cannot be rendered on its own. In Unity UI Toolkit, a stylesheet only takes effect when attached to a document. Open a .uxml file that references this stylesheet with <Style src>.
Why is an image replaced by magenta stripes?
The asset resolver missed. Check the A group, then compare uxmlPreview.projectRoot, the written path, and the GUID.
Why did an image render through GUID fallback and still produce a warning?
The image exists, but the path written in the UXML is stale. Update the document path to the actual location.
Why is a custom control only an outlined box?
The core supports only five control types. The box preserves the unsupported control's location; its B diagnostic names the missing support.
Why do Template and Instance not appear as composed UI?
Template composition is not supported. They remain explicit fallbacks instead of being silently treated as successful renders.
Why do nested relative USS imports fail?
The current core import hook does not tell the host which stylesheet requested a relative import. The extension does not guess that base path.
Why does an inline-style image URL containing XML entities fail?
Inline asset URLs can reach the resolver before those entities are decoded. The extension leaves this parser-boundary issue visible.
Why is a package file under Library missing?
Only <projectRoot>/Packages is searched. Library/PackageCache is outside the current lookup scope.
Why did the layout change when I resized the panel?
Check Fit to panel. When enabled, resizing changes the root layout size. When disabled, the fixed canvas remains the layout input.
Why did a newly created stylesheet not start working automatically?
Unresolved paths are not watched because no file existed to watch. Reopen the preview after creating the file.
KNOWN DIFFERENCES

Group C always exposes three renderer differences: browser versus Unity text metrics, wrapping-container height whose Unity rule is not identified, and main-axis percentages under an unsized parent where Yoga versions differ.

UXML PREVIEW
Version 0.1.0 · Generated 2026-08-09 · Audience: Unity developers new to this viewer
Open this file in a browser. Use Ctrl+P and save as PDF for the print edition.