Custom Style Transitions, and Custom Mesh AA

Hello there!

So, we’re using UI Toolkit in our project since ~2022. We were on Unity 21 LTS (upgrading to 22 LTS was nightmare for us, so we skipped it), and recently upgrading to Unity 6 (much smoother upgrade somehow). So much things have been changed and improved over 21 LTS and I am personally liking the direction of the UI Toolkit. Thank you so much for your efforts.

Anyway. We’re using many (I mean, MANY) custom elements and some custom style properties in our project. I am still having hard times on some areas.

For example, custom styles are not (still) very good/usable (at least there’s no improvements over there I think). Transitions are the heart of the UI “juice” and there is no way to use them in custom styles. How can I use transitions for my custom style properties? The only way I am seeing is using scheduler; but I am not sure if it’ll be performant or easy to implement. After the style resolve, I can check if my custom style is changed and update the calculated value with scheduler and every update make VE dirty for repaint and my generateVisualContent will redraw the element while transitioning. But it’s a bit hard process (check for uss transition values, etc). Also, for example, changing color value does not trigger generateVisualContent, this was changed I think in Unity 2022.x. I am using color property for my custom mesh’s background color (just for being able to use transition, otherwise I’d use custom style property), so I marking dirty for repaint my VE every CustomStyleResolvedEvent. :smiling_face_with_tear:

And for my second question, it is about generateVisualContent mesh generation’s anti-aliasing. Yeah, I know that we can now use Vector API, and I am started to use it for our custom mesh’s AA. This is my a bit old implementation of SkewedElement, I just added some bg controls and some optimizations over this code, not a big change. Anyway, I can’t use Vector API fully for this, because Vector API can’t use (or I couldn’t find a way?) images to use them as background/texture. But we need that. So I come up with an idea; I am still generating the mesh with Mesh API, then behind this mesh, I am using Vector API lines to make the edges and corners as anti aliased. I haven’t completely finished this implementation (update: I mostly completed), but the visual quality is now WAY better. And, I can also easily use borders for my SkewedElement with another shape over the mesh. BUT, is there a new change (that I couldn’t find or missed) for Mesh API to use anti aliasing for them? I don’t want to use Vector API just for AA, because it adds draw calls (update: I fixed the draw call increase; but still, I want to use only one of them) :smiling_face_with_tear: Maybe using new AddMeshGenerationJob would improve this, but I haven’t tried it yet. I think Vector API using jobs to draw, so I am suspecting (with my ignorant jobs/threads knowledge) this is the reason of the increased draw calls; so maybe using jobs for generating mesh would also solve this? :sweat_smile:

Yeah, I wrote too much, but at least I bolded my questions :sweat_smile: