기술 자료

Unity Engine


User Manual

Script Reference

Unity Engine


USS selectors

Learn how to use USS selectors by examples.
읽는 시간 1분최근 업데이트: 한 달 전

Selectors decide which elements that USS rules affect.
USS supports a set of simple selectors that are analogous, but not identical, to simple selectors in CSS. A simple selector matches elements by element type, USS class, element name, and wildcard.
You can combine simple selectors into complex selectors, or append pseudo-classes to them to target elements in specific states. USS supports descendant, child, and multiple complex selectors.

Topic

Description

Type selectorsMatch elements based on their element types.
Name selectorsMatch elements based on the name of an element.
Class selectorsMatch elements that have specific USS classes assigned.
Universal selectorsMatch any element.
Descendant selectorsMatch elements that are descendants of another element in the visual tree.
Child selectorsMatch elements that are children of another element in the visual tree.
Multiple selectorsSelect elements that match all the simple selectors.
Selectors listCreate a comma-separated list of selectors that share the same style rule.
Pseudo-classesUse pseudo-classes with selectors to target elements that are in a specific state.
Selector precedenceUnderstand USS precedence when multiple USS rules target the same elements.
Check pseudo-state of a controlCheck the pseudo-state of a control to ensure styles apply correctly.

Additional resources