Materials in UI... are they supposed to work or not?

Materials on canvas elements didn’t work. Fine. But the recent 1.1.4 has now turned them on but have a broken appearance and the following warning:


before, when they ignored the material part simply was not rendered. But now they are on and a bunch of working elements look like crap. If they are functioning as expected and just need new shaders, then we can do that. But I don’t need to waste a lot of time if the warning is accurate.

And if not supported, the better choice would have been NOT to turn on a broken feature. You have to know that many of us are porting existing games. Given the way this has progressed, a surprise of a lot of clean up work is not endearing.

Status please?

That message is meant to be purely informational; not a warning. It displays on all Image components, regardless of what properties they use.

If you submit a bug report with a specific repro case and let us know the incident number (IN-#####), then we can look into what might be going wrong.

But yes, custom materials should work, and do work in our testing. Without seeing your specific use case, there’s no way for us to know what your issue might be.

1 Like

Ah, ok, I’ll have to update our shaders then and check that. The borked masking has surfaced a bunch we normally don’t see and prior to this, the materials were not rendering at all.

It appears that custom materials done via shader graph do not support/respect masking (of either type). Is this known? Is there any additional information for this?

The only way that masking will work in custom shader graphs is if you use the same technique that Packages/com.unity.polyspatial/Resources/Shaders/MaskingShader.shadergraph and Packages/com.unity.polyspatial/Resources/Shaders/TextSDFSmoothstep.shadergraph use: the shader graph needs to perform the masking operation itself using its MaskOperation, MaskTexture, AlphaCutoff, and UVTransform properties, which are populated based on the mask state. The easiest way to do this is to copy MaskingShader/TextSDFSmoothstep from the PolySpatial package and modify them. If that doesn’t work for you, please submit a bug report with a repro case and let us know the incident number (IN-#####) so that we can investigate.

Image-based masking is broken in the current release, so Mask and RectMask2D will function the same (only clipping to a rectangular region). We’ll be fixing that in the next release.

2 Likes

Thank you, that worked for us.

2 Likes