Version: 2021.3
Test UI
Test inside the UI Builder

Debug styles

You might run into situations where you don’t know where a style is coming from. UI Builder offers several tools to investigate styles.

To see where styles are coming from:

  1. Select the element in question.
  2. Go to the StyleSheet section of the Inspector.
  3. Expand the Matching Selectors foldout:

MatchingSelectorsFoldouts

Matching Selectors will display all USS Selectors acting on the current element, in the order in which they’re applied. Lower USS Selectors will always override the same style properties in higher USS Selectors. This list of USS Selectors will include both those coming from your own StyleSheets and those coming from the default Unity theme.

UI Toolkit debugger

If the Matching Selectors section doesn’t provide enough information, you can open the main UI Toolkit Debugger under Window > UI Toolkit > Debugger. Enable Preview mode in the UI Builder before using the UI Toolkit Debugger to Pick Element inside your Canvas.

Preview mode, found in the Viewport toolbar, removes the UI Builder picking overlays from the Canvas, leaving just your UI. UI Builder runs entirely on UI Toolkit, including the recreation of your in-progress UI, so the UI Toolkit Debugger works like in any other UI Toolkit window.

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