docs.unity3d.com
    Show / Hide Table of Contents

    Debugging your 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.

    The quickest way you can see where styles are coming from is to:

    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 are 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 as well as those coming from the default Unity theme.

    If the Matching Selectors section is not sufficient, you can open the main UI Toolkit Debugger, via the Window > UI Toolkit > Debugger main menu. The key to make things easier for yourself is to 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's toolbar, removes the UI Builder-specific picking overlay and handles from the Canvas - leaving just your UI. Since UI Builder is entirely running using UI Toolkit, including the recreation of your in-progress UI, the UI Toolkit Debugger will work like in any other UI Toolkit window.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023