Search Unity

Bug UI Builder issues in 2019.4.1f1

Discussion in 'UI Toolkit' started by MvdLaar, Jul 7, 2020.

  1. MvdLaar

    MvdLaar

    Joined:
    Dec 27, 2012
    Posts:
    21
    Hi team,

    For a new project I've been working with the newly released UI Builder package to build a test menu UI. I am a designer and not a programmer, but I have lots of experience with CSS which makes life a bit easier - however, I tried to build this exclusively with the UI Builder tool.

    Below are a few very consistent and reproducible bugs/problems I wanted to share in hopes of helping the team improving the tool. I am not entirely sure which of these have been already reported, but many people here seem to not use the UI Builder that much.
    1. Setting the width of a border or radius to 0px sets only the left parameter.

      Definitely a minor issue because there's rarely a use for it, but it's weird as some other multi-layered directional settings work properly with this (like margins and paddings). It does work when all parameters already have been set prior to the change:


    2. Every selection and letter is an undo action.
      If I type the word 'Button', that would be 6 undo's to have the text gone. Would be great if this could be seen as one action. Similarly, selecting a button is seen as an action in the undo, which makes it hard to keep a mental grasp on the actual tasks that were done. Also, scaling an item is often saved as multiple steps, instead of as the initial size to the new size.

    3. Multiselecting objects in the hierarchy would be great for stuff like deleting and moving.
      I understand it might be a bit tough for all the different USS inspector data to multi-edit, but at least multi-selecting in the hierarchy to remove a list of items would be nice!

    4. Pixel sizes for width and height become huge (1mil+) when simply resizing with the mouse.

      Even though the actual size is nothing like that, the editor is very often showing massive numbers when scaling an object that had a relative scale before. As you can see in the gif, the canvas size is nothing near that scale.

    5. Font sizes are not taking into account the ascender height and descender line.
      To properly scale containers of text, we'd like to align the font size with the box size to ensure a proper physical size with text on screen. However, the font size needs to be (in this case) 4px shorter to account for the ascender and descender metrics.
    As a general note: this editor is god-tier when it comes to iteration and editing! I really love how visual it is, how feature complete and how lovely the Preview functionality is. There are a few things that would be high on my feature request list, as the following things would all be required to make game-ready UI:
    • Auto sizing on text, for localization and basic responsiveness.
    • For that matter, all the other TextMeshPro functionality would be greatly appreciated, but I know that's coming. AutoSizing is just the main one that would really need to be in a functional text editor.
    • Tiling sprites - unless I'm missing something, I can't figure out how to simply repeat a background. Using background-repeat would be great for anything tiling, which happens a lot (patterns, progress bars, whatnot)
    • Masking - I think it says in the documentation that it's possible, but I didn't figure it out yet in the UI Builder. Would be great to have the masking option on a VisualElement.
    If anyone has any questions or has an idea how to do the last two points, I'll gladly read it!

    I can add some more in this thread as I go along, but these have been the main issues.

    Cheers!
     
  2. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    Thank you for the VERY detailed feedback. It's appreciated!

    Definitely a bug. Logged now and should be fixed soon.

    Selections being part of the Undo stack is by design. It's consistent with Unity and other DCC applications. It's important to know what changes are being undone when undoing and on which element.

    As for the undo steps being created for each letter, or each resize step, this is something we can definitely improve though it's not a high priority improvement at this time.

    This should be possible now in the latest 1.0.0-preview.1 package. Let us know if it's not work properly.

    This is definitely a bug but I can't reproduce it. Would help to submit it via Unity's built-in bug reporter with maybe a copy of your UXML/USS (no need to include any images or other assets). But quick question, what zoom level were you at for this?

    I think this is by design. Text has some breathing room around it which is account for in our text size computation. If you remove the explicit Height on your label, the size of the Label will be enough to fit the text fully, including the acenders and decenders. Generally, you should not be setting explicit heights on text elements and allow their size to be font-size driven.

    Labels already resize according to the text inside. I'm not sure what you mean here.

    Yep, TMP support is coming. See the UI Toolkit 1.0 announcement here:
    https://forum.unity.com/threads/ui-toolkit-1-0-preview-available.927822/

    No. This is not yet supported out of the box. You can do it in C# with our custom mesh APIs but it gets complicated. Let me know if you'd like more details on this.

    Masking is supported. It's the Overflow style in the Display section. If you set the parent element Overflow "hidden", it will mask its children.
    upload_2020-7-9_20-51-18.png

    Always happy to get more feedback. I would just recommend starting a new thread for each topic so we can have more constrained discussions on each subject.
     
  3. MvdLaar

    MvdLaar

    Joined:
    Dec 27, 2012
    Posts:
    21
    Hi, thanks for the thoughtful answer! I hope my feedback helps. Just a few points below in response to your answers - although I can see why you'd prefer a post per bug/issue/concept, it's a bit clearer. For now I have some other stuff to attend to so I stopped working in UI builder, but will do that whenever I return to it and get more stuff like this.

    Hmm, interesting, I do have that package (published on June 19, 2020), using it in Unity 2019.4.1f1 as mentioned.

    Interesting - I am submitting the UXML/USS! I'm at 150% zoom on a fairly normal sized canvas as you can see.

    Ah, I was purely talking about TMP's AutoSize function to keep text label sizes while having longer words (for localization purposes). But thanks for the link, good to hear TMP support is coming.

    Good to know. I'm good for now but would be awesome if it comes in at some point.

    Ah, I should have clarified that I meant image/alpha masking. For example, having a fade mask on the end of a scrollView.

    Again, thanks a lot! Looking forward to updates!
     
  4. uDamian

    uDamian

    Unity Technologies

    Joined:
    Dec 11, 2017
    Posts:
    1,231
    Ah shoot, my bad. Multi-selection is only supported when using the UI Builder with Unity 2020.1 or newer. UI Builder still relies on core UI Toolkit APIs in Unity and that TreeView is one such API, which did not properly support multi-selection in 2019.

    Thanks!

    I see, so making each letter smaller to keep the overall label size the same. Yes, this should come as we add more TMP support in UI Toolkit.

    Something like a fade mask cold be done with a partially transparent image set as the background of an element that sits on top of the scrollview. You can put elements on top of other elements using Absolute position mode.
     
  5. RunninglVlan

    RunninglVlan

    Joined:
    Nov 6, 2018
    Posts:
    182
    Unity, do you plan to support multi-selection editing?
    upload_2021-7-30_13-41-43.png
    2021.2.0b4
     
    Last edited: Jul 31, 2021