Issues with UIElements / UIBuilder. Bugs or failure on my part?

Hey All,

I’ve been charged with checking out the new UIElements system, to see if it would be a good fit for my team’s needs. Results so far have been mixed, but I’m hoping that some of my pain points are just ignorance on my part. Was hoping to get some input on some of the issues I’m seeing.

1. Cannot get Visual Studio Community 8.4.7 (free version that comes w/ Unity download) to highlight syntax for UXML or USS docs. I know for a fact that VSC comes with .CSS and .XML highlighting, but he moment those extensions change to .USS / .UXML, stops working. I’ve looked around exhaustively on how to do this, because it does seem something easy to do in Visual Studio, but can’t find any options to make it work for VSC that comes with Unity.

2. Cannot multi-select in UIBuilder Hierarchy.

3. Can’t use UIBuilder with manually-written USS files in any way. I know that there is currently not an easy solution for loading an existing .USS file, but even when I add the .USS file via a STYLE element, it gets ignored by UIBuilder.

4. UIBuilder is generating empty .USS files & not saving changes to .UXML files.

To reproduce:

Step 1: Create a new UXML document. Open it in UIBuilder.
Step 2: Make changes to UXML (adding elements) and style those elements.
Step 3: Save. It prompts me to name the new .USS file and I do.
Step 4: Close UIBuilder. .USS file that was generated is blank. Re-opening the same .UXML file shows it didn’t save any styling, nor did it save changes I made by adding elements to .UXML file.

If there is something I’m missing, would be very happy to be corrected. Otherwise if these are known bugs, or issues we can expect to see corrected soon, much more likely to use in the near future.

Thanks in advance!

You did not miss it. There is no support currently for UXML and USS in the Visual Studio plugin for Unity. It’s in the plans.

This is a temporary limitation. Multi-selection is planned for the first release of the UI Builder, however, it will likely only allow re-parenting and removing multiple elements from the hierarchy at once. It will not support inline style changes on multiple elements at once, at least not initially. Shared styling should ideally come a StyleSheet and not be duplicated on every element, requiring multi-selection-editing. I’m curious what task did you try to perform that made you realize there was no multi-selection support.

You should be able to. If you create the new UXML file with the UI Builder first using an empty USS file (generated by the UI Builder), you should be able to replace the path inside the UXML to point to your manually written USS file. The Builder should pick up your other USS file when you load your UXML back up.

What will not work right now is if you set the tag right under the tag, or inside a child element that is not at the root of the document. So these two tags will be ignored by the Builder:

<UXML>
    <Style path="test.uss" />
    <VisualElement>
        <VisualElement name="child">
            <Style path="test.uss" />
        </VisualElement>
    </VisualElement>
</UXML>

You need at least one tag under one of the root elements:

<UXML>
    <Style path="test.uss" />
    <VisualElement name="element1">
        <Style path="test.uss" />
    </VisualElement>
    <VisualElement name="element2" />
</UXML>

That said, very soon, the UI Builder will learn how to deal with multiple USS files per UXML, including allowing you to add/remove your own USS files. It’s a temporary growing pain.

I cannot reproduce this problem. To be clear, you created the UXML file outside the UI Builder (but otherwise unmodified) and opened it in the UI Builder. What version of Unity/Builder are you using? Was the externally created UXML file manually modified before it was opened in the Builder?

Thank you @uDamian for the detailed response!

You are correct that I created the UXML file outside the UI Builder, and did not modify it. The versions I’m using are 2019.3.3f1 for Unity and UI Builder 0.8.4-Preview. The externally created UXML file was NOT modified before opening the builder.

Please please update the UI Builder package. :slight_smile: Latest version is 0.10.2 as of now (March 16, 2020). There is a thread you can subscribe to to get notified when there are new versions available:

Hi @uDamian , I wonder if there was any update on syntax highlighting for UXML and USS? Now using Visual Studio Community 8.5, still not seeing it work.