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