Version: 1.13.5
Unity: 2022.3.55f1
I found an issue where when I have a bunch of STMs in hierarchy branch A, and I enable a Mask object in hierarchy branch B, the STMs in branch A become invisible. Looking at the frame debugger, it's using StencilOp Equal on the objects in branch A, which is incorrect since the Mask is in branch B, and other UI objects in branch A use StencilOp Always and are not affected by the Mask.
Right now I'm using Mask Mode Ignore as a workaround, but I'd like this to work more like other UI objects in the hierarchy. Any ideas?
Example hierarchy with A and B children of the same Canvas:
Canvas > A > [STM1, STM2, STM3]
Canvas > B > Image+Mask
I'll give this a look over the weekend!
I believe I'm in the middle of changing some code related to mask modes but something like *this* is really odd... It might have to do with how I'm caching materials...? I may not be checking if the mask value is the same with material caches (STM will have two objects share a material if the base material, font, and filter mode are the same), so that could cause this to trip up! Does the error still happen if the STM objects in hierarchy branch A are given a different font? This would basically confirm that this is the issue for me!
Ok, reviewing this part of my code, and while I did attempt to compare masking values, I think I made a couple mistakes. 1. I'm comparing the ui stencil depth as a float instead of an int... 2. The "_Stencil" or "stencil ID" value I think would be a better comparison to make in this situation.
I think that change *should* fix this, but I'm also currently cleaning up the code in that area a little bit, right now. There could be something else I'm forgetting, too.
If you want to give a build with this change a shot, send me an email though my website!