Quick answer: SpriteMask does nothing to a SpriteRenderer until you set Mask Interaction = Visible Inside Mask. Verify the Sorting Layer of each affected sprite falls between the mask’s Front and Back range. SpriteMask cannot clip UI Image; that’s a different system.
You drop a SpriteMask onto a circle, parent some sprites under it, expecting clean radial clipping. Sprites render normally, ignoring the mask completely. The reason is that masking in 2D is opt-in per renderer.
The Symptom
SpriteMask placed in the scene; child sprites render full and unclipped. Toggling the mask on and off has no visible effect. No error in the console.
What Causes This
Unity 2D masking is implemented via the stencil buffer and is opt-in. A SpriteRenderer ignores all SpriteMasks unless its Mask Interaction property explicitly says otherwise. The default is None.
Additionally, each SpriteMask has a Sorting Layer range (Front and Back). Only renderers whose Sorting Layer + Order falls between those bounds are affected. Sprites above Front or below Back are ignored even if Mask Interaction is set.
The Fix
Step 1: Mask Interaction on every child. For each SpriteRenderer that should be clipped: Inspector → Mask Interaction → Visible Inside Mask (most common) or Visible Outside Mask (inverse).
foreach (var sr in GetComponentsInChildren<SpriteRenderer>())
{
sr.maskInteraction = SpriteMaskInteraction.VisibleInsideMask;
}
Step 2: Sorting Layer range on the mask. Select the SpriteMask. Front Sorting Layer and Back Sorting Layer set the inclusive range. If your sprites are on the “Default” layer, set Front = Default and Back = Default. By default the range is “Everything” on both ends; problems usually arise when you customize one end and forget the other.
Step 3: Custom Range checkbox. If you need fine-grained control, tick Custom Range on the SpriteMask and set Front Sorting Order, Back Sorting Order. Sprite Order must fall in [Back, Front]. This catches the case where everything is on one Sorting Layer but you only want to mask a subrange.
One Mask, Many Sprites
You can put the SpriteMask anywhere in the scene; it does not need to be a parent of the sprites it clips. The Sorting Layer range determines which sprites are affected, not the hierarchy. This is sometimes confusing because UI masking is hierarchical.
UI vs Sprite Masking
A common bug is using SpriteMask with UI Image components. UI Image is rendered through the Canvas system and uses Mask or RectMask2D for clipping — entirely different from SpriteMask. To clip UI use:
- Mask on a parent Image (alpha-mask, supports any shape).
- RectMask2D on a parent (axis-aligned rect, much cheaper).
Verifying
In Game View with the mask active, drag the mask off-screen. The clipped portion of the sprite should reappear. If nothing visibly changes, your Mask Interaction is still None somewhere.
“Mask Interaction on every renderer. Sorting Layer range covers them. SpriteMask is not for UI Images.”
Related Issues
For UI Mask clipping, see UI Mask. For 2D sorting confusion, see sprite sort order.
Mask Interaction is opt-in. Sorting range gates it. Sprites get clipped.