Closed achimmihca closed 2 years ago
One thing that UI Toolkit is also missing are shadows for UI elements. They weren't included in any previous Unity UI solution either, but I'm not sure how a workaround would look like to achieve them with UI Toolkit.
usually, the workaround is to place partially transparent (for example 75%) black images where you want the shadow to appear.
Unity decided to delay the release of UIToolkit further (forum):
We’ve decided to move the release to 2021.2 to ensure that UI Toolkit meets expectations, and addresses a few more requirements such as interoperability with other systems, basic support for UI animation, and onboarding material.
Looks like UIToolkit will support animations via StyleSheets soon: https://forum.unity.com/threads/announcing-uss-transition.1203832/#post-7689943
Draws player images in different colors
Will use the normal color property of UIToolkit (which makes images darker) until shaders are supported.
Maybe an alternative would be to change the pixels of the Texture2D?
I tried this. Did not work because (a) horribly slow, (b) the pixels of the texture are not readable. I think this is because Unity automatically packs the images to a sprite atlas. Thus, will wait for shader support in UIToolkit.
Draws lines for the statistics graph.
This has been skipped for now. Can be implemented once UIToolkit supports more features.
Most of the UI is currently implemented using a Component-based "Unity UI" (aka. uUI).
UIToolkit, which should be released in a stable version in 2021, will provide better separation of concerns and better maintanability. Therefor, UIToolkit builds on XML and Stylesheets, very similar to HTML and CSS.
I think the new flex-layout engine and stylesheets will make UI stuff much easier and consistent to implement. Furthermore, having the UI structure in XML makes tracing and understanding changes easier in version control.
Missing features
UIToolkit is still under development and some features that we use with uUI are missing.
[ ] UI Toolkit does not yet provide a way to load a style from a string (forum).
[ ] UI Toolkit does not yet provide a way to use custom shaders on images
[x] Rich Text Support (change colors, bold and italic embedded in the text)
Migration Status
DynamicTexture.cs
has been prepared to do the same using UIToolkit.