Any plans for gradients? Some types I can think of are linear(Directional) and 4 corner gradient. Gradients seem to be in again in the UI world and I think UI Toolkit could need this feature.
It's not on our short term TODO list, but we understand it would be a useful feature. At the moment, one way to achieve this is by using an SVG asset or the Mesh API.
The SVG package allows to import SVG assets, which can then be used with UIToolkit. The resulting vector image can be assigned to an Image element. Regarding vector image generation, we're working on a Vector API that you could use directly inside generateVisualContent, but gradients are not planned for this first iteration though. Otherwise the SVG package contains APIs to define a vector scene but I'm not sure if it's available at runtime. I'll poke the main dev of that package so he can give you a more detailed answer.
The VectorScene API from the vector graphics package is available at runtime. However, we lack the required APIs to generate UI Toolkit-compatible VectorImages at runtime, this part is only available in the editor for the SVG importer. This gap should be resolved eventually, but I can't provide an ETA.
Ok, so if I get this right; Currently I can use SVGs for UI Toolkit runtime, but not Vector Scenes, which are procedural vector elements?
Correct. You can use VectorScene can dynamically generate 2D sprites at runtime, but you won't be able to generate UI Toolkit assets (VectorImage) at this time. A workaround would be to dynamically create a VectorScene with a gradient, then create a sprite from it (using VectorUtils.BuildSprite), and convert it to a texture (using VectorUtils.RenderSpriteToTexture2D). This a quite heavy workflow, but the resulting texture could be used by UI Toolkit. VectorUtils docs: https://docs.unity3d.com/Packages/c...2.0/api/Unity.VectorGraphics.VectorUtils.html
If generated only once and cached it this is still a perfectly viable option in certain projects, not as a feature though - left up to the user (assuming this works at runtime).
I'd like to throw in another vote for this. Gradients are much more important in game UI than web UI. For example, a quick browse of https://www.gameuidatabase.com/ shows roughly 75% of them have some sort of gradients going on, although many are fairly subtle or to provide depth.