Hi folks,
It has been a while since we reached out with an updated message about a general overview of the UI Toolkit’s direction.
The landscape of UI systems at Unity
First of all, we want to reiterate our commitment to make UI Toolkit the singular UI solution in the Unity product. This is a long term aspiration but we still firmly believe in this direction.
We are in a continuous process to find and document parity gaps and assign the most intelligent priorities in our roadmap. Our insights come from conversations with internal stakeholders and customers, and of course from this little corner of the Unity forums.
We are aware that UI Toolkit is not yet capable of fully replacing IMGUI and UGUI, but we are getting there. In this post we will talk about what we have been working on for Unity 2022, what to expect in Unity 2023 and what will be coming only in future releases.
As a side note, we have updated this comparison page in our User Manual as a guide through the process of choosing which UI system to use or start a project with:
https://docs.unity3d.com/2022.1/Documentation/Manual/UI-system-compare.html
This page will be updated for each Unity version.
UI Toolkit improvements in Unity 2022
In Unity 2022, we have made leaps forward in closing the gap between what can be achieved with IMGUI for Editor UI. UI Toolkit is now in a better position to receive wider adoption both inside and outside Unity:
- The Inspector Window now uses UI Toolkit to generate default Inspectors while falling back on IMGUI only for existing IMGUI PropertyDrawer and Editor implementations
- All the main Unity attribute and type PropertyDrawers have been ported to UI Toolkit
- The ListView now supports the same features as the IMGUI ReorderableList
- We have added the TreeView and MultiColumnTreeView controls
- We have added new Vector drawing APIs for programmatic shape rendering
- We have improved the documentation by adding more topics about the UI Toolkit feature set as well as explaining the migration path from IMGUI
We have also improved the performance of the core systems. Many of these improvements benefit the Editor use case as well as the Runtime UI use case:
-
Layout and styles
-
Lower overhead from GeometryChangedEvent
-
Updating styles on an element should no longer cause unnecessary invalidations of the layout or geometry
-
Rendering
-
Turning the USS styles of a VisualElement into a mesh is now faster, expected gain is in the order of 10x
-
Usage Hints are now set automatically when using USS Transitions, leading to better performance when animating VisualElement styles
-
Font textures are now bound through one of multiple textures slots from the UI shader (instead of a single one before) which means it’s possible to achieve a lower number of draw calls
With these improvements, UI Toolkit becomes the recommended solution for making extensions to the Unity Editor.
Plan of intent for 2023
Our goal for 2023 is to improve the efficiency of UI Toolkit, both in terms of performance and workflows.
The data binding feature set is currently limited and not very easy to use. We are hard at work on a generic data binding workflow for both Editor and Runtime UI. This system is built on top of the Unity.Properties system, which is being promoted to core Unity. Once the core of this workflow is in place, we are going to review the current SerializedProperty-only binding system and improve how it will be supported alongside the more generic one.
Also in spite of our performance improvements in Unity 2022, UI Toolkit still imposes a high initialization cost for even moderately complex UI. We are in a situation where it is very difficult to extract more CPU performance from the current C# implementation of UI Toolkit core systems. There will therefore be a more fundamental shift in the UI Toolkit implementation which we intend to make an order of magnitude faster. This will apply to the performance of core features that are CPU intensive, such as processing layout changes and style changes, computing transforms and preparing the geometry of a VisualElement.
Lastly, we want to dedicate some time to improving the UI Builder. Because it plays such an important role in a majority of workflows, and based on a lot of the feedback we received, we will review the architecture of the UI Builder in order to improve its level of stability and extensibility, and to make it easier for us to add new features to it down the line.
Under this general direction, we hope to provide a robust foundation that allows us to evolve UI Toolkit in a sustainable way, as well as improving the experience of using it for both tools and game UI developers.
Stay connected
As always, keep sharing feedback, asking questions and reporting issues so we can build a better UI solution for you. Also, remember to visit our Unity platform public roadmap to engage with us and submit new ideas.
Cheers,