Label needs “Auto-Size” feature like TMP or “Best Fit” like Text (Legacy). Maybe not in editor, but definitely in runtime.
Also, I hope you don’t get laid off before achieving these goals
UITK needs to be better.
Label needs “Auto-Size” feature like TMP or “Best Fit” like Text (Legacy). Maybe not in editor, but definitely in runtime.
Also, I hope you don’t get laid off before achieving these goals
UITK needs to be better.
yes… Do you remember Flash?! How easy it was to add such effects?
With UGUI I can use a cheap asset store add on to add drop shadows, resolution-independent rounded panels, glows and probably gradients and blurs since shader graph support added.
If these are not in UI Toolkit out of the box it is another reason to delay changing.
Indeed, we are.
I personally tried to fix this in the past and quickly ran into complications (mostly usability complications). The question becomes “% of what?”, given that the Text usually drives the size of our elements, including the button. So, Text as a percent size of its container doesn’t really work. I’m not saying it’s off the table since it comes up a lot, but just that it’s more of a medium-hanging fruit.
It’s still on the roadmap. We know we need this to be able to say “parity”.
So far so survived! ![]()
I mean, uGUI also doesn’t have these out-of-the-box, given you need an asset store add-on. And a very quick search does yield at least one UI Toolkit effects package you can get for UI Toolkit:
But yes, we do want to have more of these effects built-in.
I really like the concept of UI Toolkit and definitely prefer working with it over UGUI. However, I frequently run into issues, mostly related to performance.
First, the shaders used for UI elements (I wrote about it here) cause problems on older hardware. This has made me consider reworking my entire GUI for one project, switching from UITK back to UGUI.
Another issue is binding performance. I haven’t submitted a bug report yet since my case is quite specific and I haven’t fully investigated it, but in general, bindings tend to be slow. Even with fewer than ten bound values, I experience issues like the one shown in the following screenshot when interacting with the UI.
Lastly, I miss having 3D transformations, as they would allow for effects like flipping a card. Since they are not supported, I’ve sometimes had to create a “copy” of the element in UGUI, apply the 3D transformation (animation) there, and then switch back to the UITK element. ![]()
The MonoJit calls probably indicate that it’s the very first update and C# needs to do some just-in-time compilation of the code. These calls should happen only once per domain.
The GC.Alloc seem to indicate that the property bags used for the bindings are generated during that frame as well. These are generated using reflection unless code-generation has been requested for them. I would suggest to switch to code-generation to avoid the allocations there (provided that they are indeed caused by the creation of the property bag). The update itself of DataBinding should be allocation-free in most cases.
We still have lots of potential for optimization of course, but to get a better idea on it, I would profile the other updates as well. Keep in mind that deep profiling adds a lot of overhead as well.
You bring up a good point.
What makes most sense to me, is if text size is set to %, then it doesn’t contribute to layout calculations. Then at that point it makes sense for text size % to be a percentage of the size of the container element.
This is also something we’re actively working to improve (low end device rendering). Not a lot to share yet, but it’s in the works.
Interestingly css doesn’t support % font size either. They defines it to be % of parent font size, or the same as em. Probably for the same reason.
so my question is the “Single Solution for Unity” still a thing? or devs still fight with “2 UI frameworks and 3 Text frameworks” stuff in Unity Next Gen ?
Adding samples is not the same as new features.
Indeed, that’s still the intent and what we’re working towards. But it’s going to continue to take time and sometimes there will be opportunities to add some value to the existing UI frameworks that a lot of users continue to rely on.
I understand the point, but to some degree, not “deprecated” means more friction/confusion to both unity and users (especially new newcomers and asset devs), and this happens a lot in the history of unity.
i personally favor more aggressive choice (deprecate everything duplicate), for existing users, LTS is the right way to go.
We do have in mind a way to address this with the new data bindings system, maybe not in the near term future - but it’s possible to do it today with a bit of code and custom bindings. Here’s documentation on custom bindings. Having command/event support is all part of having a better integrated experience when using UI Toolkit, being closer to the game object world by enabling references between the two, and is definitely something we want to address at some point! Thanks for the feedback!
It’s already been asked in other threads (like here and here), but maybe this is a better place to get an answer.
To reiterate, are there any plans to create an API similar to TMPro’s SetText()/SetCharArray()? It basically allows you to format text (and also numbers!) in a way that creates zero garbage allocations (unless the underlying array needs to be resized of course) because it never actually creates strings. It does create strings in the editor though, since the text has to be displayed in the inspector, but that doesn’t matter. UI Toolkit seems to only work with strings however.
My game updates a lot of numbers at a high frequency and TMPro makes this work pretty well. If I were to use UI Toolkit, I wouldn’t feel comfortable having to invoke .ToString() in a lot of places constantly. Call it premature optimization or whatever, I think having such an API is great for many games, as it’s otherwise an easy way to increase GC pressure, even if it’s only a little.
So my question is: Is something like this planned and if so, when can we expect such a feature?
Lots of great features on the roadmap, especially the post-processing which is really needed. Cant wait to try them!
That being said, I think there are some critical and basic functionalities/properties missing from UiTK:
aspect-ratio property.vh, vw, vmin, vmax (viewport percentages) is very detrimental.Without these, dynamic and resolution indipendant Ui layouts become either impossible to make or scripting intensive (and scripting comes with its performances costs and overall jankiness in UiBuilder).
You could use the panel’s Scale Mode to scale with screen size, then decide a reference resolution to work with in Ui builder and just set the lenghts in pixels (after calculating yourself the % to px conversion of elements yourself), but that’s the exact opposite of working in percentages, and you’d lose all the advantages of creating using them (it takes longer to make and to maintain).
I also have a feature request for styles Data Binding:
If i want my application to have a fully customizable (no presets!) theme for Ui, that for example changes all the elements’ background colors, text colors and font assets, the only way to do it right now is to bind the specific attributes of every single affected VisualElement to the theme data, which is both very manual and bad for maintanability (if you change the data source names or how it works, go and rebind everything!), and probably not very performant.
The optimal way to do this would be using a single USS rule that changes the style, and the values of said USS rule’s parameters would have to be editable at runtime (preferably through data binding).
Keep up the good work!
To add to this idea, I have my own localization system in which all the localization for a given language is stored contiguously in a single char array. Having the ability to give a reference to that array, an offset and a length would make it very efficient to transmit localization data, avoiding a lot of copy along the way.
something like text.SetSource(array, start, length)
I’ll answer this part of your post - One thing that doesn’t show up explicitly in our roadmap but that we’ve been working on internally is to have an API to create/edit/save uxml and stylesheets. This feature would also be available at runtime eventually. So you could potentially create a theme/stylesheet to customize selectors and apply it to your UI - though there would be a performance cost associated to that. That feature is still very in progress as we are working on nailing the API, plus we need to make the UI Builder aware of external changes before we can make this public, but something to expect in the future of UI Toolkit still!
I’d still recommend looking into theme/stylesheet presets and style variables till then
Or possibly create custom bindings that could act on multiple common style properties that you know would change often and apply them as inline styles.
Did a quick test of the UI Toolkit support for World Space.
Was simple to set up and quick to work with. Honestly faster than setting up UGUI.
Even figured out how to get a custom shader for the canvas background. Going to be working on a holographic interface using world space support now for testing.
Anyone that downloads the 6.2 alpha 6 to try it out and don’t see it at first. There is an option you need to toggle on. In project settings → UI Toolkit, there is a Enable World Space Rendering toggle you need to enable.
After that in your panel settings asset a new dropdown option called Render Mode will appear with the world space mode.
You can have different panel settings to mix and match world space and screen space-based UI Toolkit rendering. If you want to place text on a transparent object or panel. You can have the transparent object be a parent object with a custom shader. Add a child object with a UI World Space document. For the UI document object, change the material transparency render queue to be over 3000 which is the default transparency render queue value.
Example of it below in the linked image
Thanks for the answer!
That feature will be great for customization, and will speed up setting up customizables themes by a lot!
What about these other functionalities I suggested? I dont wanna seem pushy, but these are pretty essential for building basic responsive UI layouts, especially if we consider the wide range of resoluions of the mobile market…
Man I just want USS feature parity with CSS.