I have some elements that I’d like to respond to game state by darkening and desaturating the image. I can’t find any equivalent to the CSS “filter” property, or anything that would let me change the appearance of an image.
How can I do change the brightness/saturation or otherwise filter an image in UI Toolkit? I don’t mind if I have to write a custom VisualElement for it.
Hey! You can use an ImmediateModeElement to write your own custom shader in UI Toolkit: Unity - Scripting API: ImmediateModeElement. You just need to override ImmediateRepaint. There are some limitations though, stencil-based masking might not work properly (e.g. overflow=hidden with rounded corners).