UltraStar-Deluxe / Play

Free and open source singing game with song editor for desktop, mobile, and smart TV
https://ultrastar-play.com
MIT License
393 stars 73 forks source link

Migration to UIToolkit #231

Closed achimmihca closed 2 years ago

achimmihca commented 3 years ago

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.

Migration Status

timgoeller commented 3 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.

basisbit commented 3 years ago

usually, the workaround is to place partially transparent (for example 75%) black images where you want the shadow to appear.

achimmihca commented 3 years ago

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.

achimmihca commented 2 years ago

Looks like UIToolkit will support animations via StyleSheets soon: https://forum.unity.com/threads/announcing-uss-transition.1203832/#post-7689943

achimmihca commented 2 years ago

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.