Version: 2022.1
UXML element VisualElement
Introduction to USS

Style UI with USS

Each visual elementA node of a visual tree that instantiates or derives from the C# VisualElement class. You can style the look, define the behaviour, and display it on screen as part of the UI. More info
See in Glossary
includes style properties that set the dimensions of the element and how the element is drawn on screen, such as backgroundColor or borderColor.

Style properties are either set in C# or from a style sheet. Style properties have their own data structure (IStyle interface).

UI Toolkit supports style sheets written in Unity Style Sheet (USS). USS files are text files inspired by Cascading Style Sheets (CSS) from HTML. USS syntax is the same as CSS syntax, but USS includes overrides and customizations to work better with Unity.

Topic Description
Introduction to USS Understand the fundamental building blocks of a USS.
USS selectors Learn how to use USS selectors by examples.
USS properties Learn everything about USS properties.
USS custom properties (variables) Learn everything about USS custom properties.
Apply styles with C# Learn how to apply style sheet to visual elements in a C# script.
Best practices for USS Understand what you need to know when you write USS.

Additional resources

UXML element VisualElement
Introduction to USS
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961