Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

I look forward to a better UI system

Discussion in 'UI Toolkit' started by kvfreedom, Aug 14, 2021.

  1. kvfreedom

    kvfreedom

    Joined:
    Mar 30, 2015
    Posts:
    42
    I have been using Unity for 7 years, from NGUI to UGUI. I have used Unity2020's UGUI to make a very complex UI system for commercial games. Most of the requirements can be achieved, but it is not so easy and comfortable.

    Below I list some of the complex game UI requirements I have encountered:
    1. The game needs to add particles, 2D graphics, and 3D objects to the UI panel, some before the image, some behind the image, some pre-placed in the prefab, and some are generated when the game is running.
    2. All UI elements (including particles, 2D graphics, 3D objects) can be masked by the same mask component, the size and shape of the mask can be customized, and the mask can also be nested.
    3. The button can be triggered without an image, and the size and shape of the trigger range can be customized.
    4. The UI panel as a whole or partly supports disabling the trigger, changing the transparency, and superimposing some effects (blur, bloom, etc.).
    5. Each UI panel can individually choose to use screen space or world space.
    6. Support hot update, ensure the consistency of the scripting language, do not use another scripting language such as lua to achieve.
    7. Support localization, users can choose synchronous or asynchronous two modes.
    8. The text can be set with complex animation.
    9. It is recommended to use a unique ID instead of a user-set name for scripts referencing UI elements to avoid problems caused by users modifying the names of UI elements later.
    The Unity staff told me that the UI Toolkit will fulfill my needs in the future. After trying out the UI Toolkit of Unity 2021.2, I changed from expectation to doubt. Game UI and editing UI have their own unique needs, and it may be difficult for a UI system to meet both needs at the same time. A better choice may be to have a basic UI framework on which to develop two independent UI systems for games and editing, and even users can develop their own UI systems under the basic UI framework (refer to URP for games and HDRP for movies).
     
    Last edited: Aug 15, 2021
    burningmime and MousePods like this.
  2. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    812
  3. kvfreedom

    kvfreedom

    Joined:
    Mar 30, 2015
    Posts:
    42
    The roadmap looks good, but I can't imagine it can be achieved very well under the existing framework.
     
    MousePods likes this.
  4. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    UI Toolkit doesn't support any of these, and with the web-inspired direction they're going, several of these will be very awkward to implement. The only game UI framework I know of that made these things easy was a certain discontinued Flash-based one made by Autodesk.

    I'm really on the fence about Toolkit runtime right now. Just the other day, I wanted to make icons edges glow using a SDF. Without being able to use a custom shader, I ended up needing to create a separate render target, draw it there, and assign that to the background. That's not performant nor is it easy to use.

    Need to render some 3D objects in front of the panel? Render target. Want to blur the background behind the panel? Render target. Want some interesting text effects that aren't exposed? UGUI+TextMeshPro and layering that on top of the UITK. Gradients? Generate the mesh vertices yourself.

    You can do it all with render targets and/or manually generating the vertices, but that's no longer using the UI framework for anything but layout. Heck, even focus/events I find easier to handle directly in some cases to make it feel natural with a controller (consider a grid of items; default focus completely fails there). So it's mostly become a layout engine. Which is better than nothing, but not the UI framework I imagined when I started this project.
     
    Midiphony-panda and KamilCSPS like this.
  5. kvfreedom

    kvfreedom

    Joined:
    Mar 30, 2015
    Posts:
    42
    If UI Toolkit can also be used to make web pages in the future, that would be a great feature.
     
  6. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    If you want to make webpages with CSS and flexbox, I have some good news for you :cool:

    I'd rather they focus on making a game/simulation UI framework.
     
    Midiphony-panda likes this.