Version: Unity 6.0 (6000.0)
Language : English
Add a sprite mask
Sprite atlas

Sprite Mask component reference

Explore the properties you use to hide and reveal parts of sprites with a spriteA 2D graphic objects. If you are used to working in 3D, Sprites are essentially just standard textures but there are special techniques for combining and managing sprite textures for efficiency and convenience during development. More info
See in Glossary
mask. For more information about using sprite masksA texture which defines which areas of an underlying image to reveal or hide. More info
See in Glossary
, refer to Masking sprites.

Property Description
Mask Source Selects what to use as the source of the mask texture. In the mask texture, use opaque pixels for the mask shape, and a transparent background for outside the mask. The options are:
  • Sprite: Uses the texture from a sprite.
  • Supported Renderer: Uses the texture from the sprite on a renderer component attached to the GameObject.
Sprite Sets the sprite to use as the source of the mask texture. This property is available only when you set Mask Source to Sprite.
Supported Renderer Sets the renderer to use as the source of the mask texture. This option is available only when you set Mask Source to Supported Renderer, and the GameObject has one of the following renderer components attached:
  • Sprite Renderer
  • Sprite Shape Renderer
  • Tilemap Renderer
Sprite Sort Point Selects the point Unity uses as the distance of the mask from the camera, for example in sorting calculations. This option is available only when you set Mask Source to Sprite. The options are:
  • Center: Uses the center of the sprite.
  • Pivot: Uses the Pivot property of the sprite. For more information about setting the pivot point, refer to Sprite Editor.
Alpha Cutoff Sets the lowest alpha value Unity uses as a mask pixelThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
See in Glossary
. Lower values mean Unity includes more transparent pixels in the mask shape.
Custom Range Sets the range of sorting layers that the mask affects. For more information, refer to the Custom Range properties section.
Rendering Layer MaskA value defining which layers to include or exclude from an operation, such as rendering, collision or your own code. More info
See in Glossary
Sets which rendering layers the mask affects. For more information, refer to Rendering layers.

Custom Range properties

Sets the range of layers that the mask affects. These properties are only available when you enable Custom Range.

For example, if you set the Back Sorting Layer property to sorting layer 1 and the Front Sorting Layer property to sorting layer 2, the mask affects only sorting layer 2.

Property Sub-Property Description
Front Sets the highest layer and sublayer the mask affects.
N/A Sorting Layer Sets the highest layer the mask affects, so that layers in front of this layer aren’t affected by the mask.
N/A Order in Layer Sets the highest sublayer in the Sorting Layer that the mask affects.
Back Sets the lowest layer and sublayer not affected by the mask.
N/A Sorting Layer Sets the lowest layer not affected by the mask, so that both this layer and the layers behind aren’t affected by the mask.
N/A Order in Layer Sets the lowest sublayer not affected by the mask.

Additional resources

Add a sprite mask
Sprite atlas