Multiple Sprite Masks / Rendering Layer Masks? (Unity 2D)

On my current course, I’m learning how to use sprite masks in Unity. It’s a cool feature but I was wondering if it was possible to have multiple sprite mask layers. An example may be, one layer for decals (like a blood splatter), a separate one for reflections, and another separate one for outlines that appear in front of objects in the foreground ETC. I noticed there was an option to specify the rendering layer mask on the sprite mask component, and on sprite renderers, but either I haven’t figured out how they work or they are not meant for 2D.

In the screenshot below, I set the rendering layer mask in my Sprite Mask to “Layer 2”, and to “Layer 1” on the Sprite Renderer in my splatter object. I would have expected it to not show up inside the mask due to being on a different rendering layer, but it does.

SOLVED! I checked the Custom Range box in the sprite mask, selected the desired sorting layer in both Front and Back, and made sure that the order in layer(s) range fully encompassed the Order In Layer of my desired object.

At first it was giving me unpredictable results, but I played around with it and realised that Back > Order In Layer has to be lower than the splatter’s order in layer. Back's Order In Layer seems to non-inclusive, whereas Front's seems to be inclusive. I guess if you set the numbers really large in both directions, then you don’t need to worry.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms