Search Unity

Bug UI Won't display, NO idea why

Discussion in 'UI Toolkit' started by BruceKristelijn, Oct 15, 2021.

  1. BruceKristelijn

    BruceKristelijn

    Joined:
    Apr 28, 2017
    Posts:
    108
    So after googling I couldn't find out why my UI stopped showing. One to another day it just stopped working. My co workers all still see the UI and it works. But in my game it just will not show!

    I tried deleting the packages and resetting all settings to no avail. Does anyone have an idea to debug this? When I change the clear color settings to black I get a completely black screen. Thank you in advance.
     
  2. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    700
    Hello, can you confirm if you're using UI Toolkit for your UI? There are 2 UI systems (UI Toolkit and UGUI) and the answers will be different for each one.

    Are you using the Canvas component? Or do you have UXML/USS files and a PanelSettings?
     
  3. BruceKristelijn

    BruceKristelijn

    Joined:
    Apr 28, 2017
    Posts:
    108
    Yes I am using UI Toolkit downloaded with the package manager, both UI Toolkit and Builder are Version 1.0.0-preview.18.
     
  4. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    700
    Thanks for confirming!

    Do you see anything at all? What about if you open the UI Toolkit Debugger, do you see anything on the hierarchy for your game's UI?

    There was an issue with loading the Default Theme Style Sheet but that was fixed with preview.18, though if you can try right clicking on the asset and selecting "Reimport" that could help.
     
  5. BruceKristelijn

    BruceKristelijn

    Joined:
    Apr 28, 2017
    Posts:
    108
    So I tried the UI Debugger and I noticed all elements are there but are invisible, even when hovering (won't show on a screenshot) the element is in the proper location:

    When inspecting further I cannot see any styles, even after clicking "show all":


    I Re-imported the packages but that will not work.
     
    Last edited: Oct 16, 2021
  6. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    700
    The height of the element you highlighted on your screenshot is zero, that's why they're not showing. Without looking at the UXML and code it'll be hard to tell what's wrong though.
     
  7. BruceKristelijn

    BruceKristelijn

    Joined:
    Apr 28, 2017
    Posts:
    108
    Sorry for the late reply, I have not changed the height settings. It seems like the UIDocument wont use any uss files? Like it wont have any styling.
     
  8. Maverick

    Maverick

    Joined:
    Dec 18, 2009
    Posts:
    240
    I had same issue once. My problem was in panel settings, I had to recreate it once more and assign to ui document.
     
    BruceKristelijn likes this.
  9. BruceKristelijn

    BruceKristelijn

    Joined:
    Apr 28, 2017
    Posts:
    108
    Wow! that was it!, thankyou very much haha
     
  10. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    700
    I see that you got it fixed, and that's great, but to answer your question the UIDocument itself does not do anything regarding USS files. You have to set your styles on your UXML, or you can set StyleSheets by code, of course. Also, the PanelSettings has a Theme Style Sheet set, you can see it in its inspector. The Theme Style Sheet holds the basic styling for font, colors, button appearance, etc.

    Hope this helps clear it up!
     
  11. yjmantilla

    yjmantilla

    Joined:
    Dec 31, 2021
    Posts:
    1
    Wow, thanks! This worked!