Version: 2022.1
Test UI
Test inside the UI Builder

Debug styles

If you don’t know where a style comes from, UI Toolkit offers several tools to investigate styles.

Matching Selectors

You can find the styles for an element in the Matching Selectors section in the UI Builder’s Inspector.

  1. In the Canvas of the UI Builder, select the element.
  2. In the Inspector window, expand StyleSheet > Matching Selectors.

An example Matching Selectors

The Matching Selectors section displays the following:

  • USS selectors from your own style sheets
  • USS selectors from the default Unity theme

Note: USS selectors that appear lower in the list always override the same style properties in higher USS selectors.

UI Toolkit debugger

If the Matching Selectors section doesn’t provide enough information, you can use the UI Toolkit Debugger.

  1. In the Viewport window of the UI Builder, click Preview to enable the Preview mode.
  2. Select Window > UI Toolkit > Debugger.
  3. In the UI Toolkit Debugger window, select Pick Element.
  4. In the Canvas of the UI Builder, select the element that you want to debug.

The UI Toolkit Debugger window displays the following:

  • All child elements of the visual element
  • All USS selectors for each component of the visual element
  • Detailed information for each USS selector

其他资源

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