Mask a Sprite with multiple SpriteMasks?

Would it be possible to have a Sprite masked by two different Spritemasks? Specifically, to have an already masked Sprite also be masked by another SpriteMask? Here is a diagram explaining the issue I’m facing when testing:


alt text


The character portrait is supposed to be masked by SpriteMask 1 here, but they appear fully because of SpriteMask2.


Thanks, cheers~

I have the same issue with a similar setup.
I have read, that you can fix this via the sorting layers, but thats not true.,

This is probably the way to do it haven’t figure it out yet myself:

I think it is possible, but most definitely not something straightforward. I used SpriteMask with Mask Interaction property set to Visible Outside Mask. The trick is to invert sprite used for masking (now it is not rectangle but rectangular “hole” in plane) and define CustomRange property on SpriteMask component properly. Let me explain it on attached image.



  1. Create inverted sprite for masking, i.e. plane with rectangular hole in it.

  2. Create a single card.

  3. For card “prefab” add SpriteMask component and set Mask Interaction property on SpriteRenderer component to Visible Outside Mask.

  4. Place cards into grid. For each card set up proper Custom Range on SpriteMask component to avoid masking cards in neighbourhood, e.g. set first card sprite to layer 10 and SpriteMask for Custom Range 9-10, next card to layer 12 and SpriteMask for Custom Range 11-12 …

  5. Finally, create SpriteMask for the group, just set the CustomRange property of this SpriteMask component to include all child cards layers.

Note: Orange outlines are sprite masks scaled to desired size.