Search Unity

Feedback: needed features and fixes

Discussion in 'UI Toolkit' started by imblue4d, May 1, 2021.

  1. imblue4d

    imblue4d

    Joined:
    May 27, 2016
    Posts:
    110
    Hi
    After using the UIToolkit for runtime UI i decided to give some feedback, i'm listing all the unfulfilled needs that i had in my experience.

    Needed features (in order of priority):
    - transform (position, rotation, scale)**
    - transitions (duration, timing function, delay)**
    - filters & backdrop-filters (ex: blur, grayscale, contrast, hue, drop-shadow)

    Needed fixes:
    - when renaming a class in UI Builder all visualElements using it still retain its old name leaving us to having to reapply it to every one of them**
    - Button's text size affects button dimensions (visible when using flex)**
    - How to sort class priority over a visualElement? do we need to change class order by manually editing the uss file?

    Nice to have:
    - function to get list out of Queries, i figured out by searching in the source code that using by"Query<>().Build().ToList()" we can have the wanted result, it would be nice to wrap this around a function named something like "QAll<>()" or "QueryAll<>()"
    - editable uxml and uss code in the bottom part of UI Builder

    ** most important of the bunch

    I really wish for them to be sorted out because i believe this package has a huge potential, mainly because:
    - the iteration times are much faster than in uGUI
    - my scripts are much less spaghettified as a result of keeping all the UI under one gameObject
    - no need for textMeshPro (which added complexity in code and project folder)
    - no need for prefabs
    - great potential for emergence of javascript-like libraries in the asset store
    - easy scrip based generation (not as much as IMGUI but much better than uGUI)
     
    Nexer8 and benoitd_unity like this.
  2. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    572
    Thanks for your feedback!

    There is already a support for moving the visual element after the layout in c# with the visualElement.transform interface if you need something immediately to experiment. Keep in mind we only support 2d transformations for now.

    Transitions and transform are indeed a good tool for motion design in general and the team is aware of their importance.
     
    imblue4d likes this.
  3. AlexandreT-unity

    AlexandreT-unity

    Unity Technologies

    Joined:
    Feb 1, 2018
    Posts:
    377
  4. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    572
    Regarding the renaming in the UI builder, because that they may be multiple classing having the same name in different files, we cannot know what exactly to rename. There was actually a prototype of the feature done at some point, but the result were causing surprising behaviors.

    Can you provide more detail on this? From my understanding it coud be the expected behavior but if I misunderstood and it is a bug, better fix it asap :)
     
  5. imblue4d

    imblue4d

    Joined:
    May 27, 2016
    Posts:
    110
    Thanks, will it be eventually available for manipulation on the UIBuilder's inspector? it doesn't seem to be style driven.

    If there could be multiple classing then there is already some way to differentiate between them? maybe by the selector's difference, by the class' file or by its reference? i mean, in the end looking at how work is done in webdev, same class name in another file just overrides the previously applied one; and if the are multiple classes with the same name they have to have a different selector

    Sure i'll put a svreen recording here


    And regarding this? i haven't had an urgent need to change class list order for any element yet, but i think i could need it in future

    Thanks for your responses

    Edit: typo
     
    Last edited: Aug 24, 2023
  6. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    572
    It would be practical to set up the transitions. :) Stay tuned.

    For the resize part, it seems like it is the expected flex behavior: The element default size are measured and then the remaining free space on the line get split according to the flex value. Changing the text value changes the default size. You can set the flex-basis value to something other than auto to ignore the size of the text in the layout calculation.
     
  7. uMathieu

    uMathieu

    Unity Technologies

    Joined:
    Jun 6, 2017
    Posts:
    398
    To build on what Simon said above:

    When given the available size, the flex layout will perform multiple passes to distribute that space along the flex-direction:
    - First it sets each element to its flex-basis value.
    - If more space is available, it will distribute this space using the weighted average of the flex-grow values
    - If not enough space is available, it will remove space from each element according to the weighted average of the flex-shrink values

    When flex-basis is set to auto, flex will measure the element (using text and font parameters) and use this as base, otherwise the default is 0. In your case, since you don't want to take text size to influence the layout, you can set flex-basis to 0 on your buttons.
     
  8. imblue4d

    imblue4d

    Joined:
    May 27, 2016
    Posts:
    110
    Cool!

    Thanks, setting flex basis and the shrink value to 1 for all 3 childs solved the problem
     
  9. SimonDufour

    SimonDufour

    Unity Technologies

    Joined:
    Jun 30, 2020
    Posts:
    572
    Regarding the ordering of the class: The priority of the selectors are not affected by the order in which the class are listed on the element, but they are prioritized in the order they show up in the styleSheet. You can reorder the selectors in the top left part of the UI Builder.
     
    imblue4d likes this.