VisualElements not displaying

I’ve just started using UI Toolkit, trying to follow a beginner tutorial on YouTube, and my VisualElements are not displaying at all. I’ve set a background color and a size, first as Inline style and then using a Style Sheet. When I used a Style Sheet I unset the Inline properties. Other elements like Buttons seem to be working as expected.

I’ve tried rebooting, starting a new project, following tutorials to the letter, all to no avail. The only glimmer of progress was getting a red square to briefly flash up in the UI Builder but this only served to make Unity angry and it deleted the Style Sheet I was using - after recreating it with the same settings there was nothing appearing again.

I’m using Unity Editor 2022.3.1f1 on OSX 12.6.9.

Can you share an example project where it’s not working as you expect?

Sure, how exactly should I do that?

Zip it up(without the Library folder) and either include it into the forum post or use some file sharing such as Google drive

Okay, here you go.

9352379–1308185–Toolkit Example.zip (59.6 KB)

Oh this got me for a moment :smile:
You had the GameView zoomed in so the UI could not be seen.

Change this Scale value back to 1 and you should see the UI. Note in your example the background alpha was 0 so you need to change that to 1 to see it.

Well, there’s egg on my face! Can’t believe I didn’t think to check the opacity. Thanks for your help.

1 Like