> For the complete documentation index, see [llms.txt](https://myty.gitbook.io/myty-kit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://myty.gitbook.io/myty-kit/make-animation/advanced-animation/sprite-masking.md).

# Sprite Masking

## What is Masking?

<figure><img src="/files/FnP21LR6yIYkxNI1Xh4K" alt=""><figcaption></figcaption></figure>

* In Unity, the mask is a component that automatically crops the target sprite like a window.
* Technically, you will need two game objects: **the target object** and the **masking object**.
* You can add one of the game objects as a child if you want.\
  ![](/files/rGfjaiEwSbBY0uVTdzTw)
* If you want to use the masking for your Avatar, you should use the **Rigged Mask 2D Component** instead of the Sprite Mask.&#x20;

{% hint style="danger" %}
The Sprite Mask **wouldn’t work on rigged sprites** in Unity.&#x20;
{% endhint %}

## How to apply the masking effect?

1\. It is pretty straightforward. Make sure to select the GameObject that you want to use as a Mask

2\. In the inspector, click the <mark style="color:purple;">`add component`</mark> button and select the <mark style="color:purple;">`Rigged Mask 2D`</mark>.

<figure><img src="/files/HYl04gnkPFBmgXihdf3v" alt=""><figcaption></figcaption></figure>

3\. Tab the <mark style="color:purple;">`Fit to source sprite`</mark> button.

<figure><img src="/files/8MWWBHzya7trjDWkLbhy" alt=""><figcaption></figcaption></figure>

4\. That’s it. Now you will see the source sprite is cropped.

<figure><img src="/files/zd1Pxi6cRFRkGwB0w3jV" alt=""><figcaption></figcaption></figure>

{% hint style="danger" %}
It is not going to be working **if the masking sprite has multiple bones**
{% endhint %}

{% hint style="success" %}
**If you want to animate masking sprites**, you might need to add the Sprite Resolver
{% endhint %}

5\. There are several options that you could choose from in the Mask Interaction.

* None
* Visible inside Mask
* Visible outside Mask

<figure><img src="/files/7A15Lh92G9WCWNaun0el" alt=""><figcaption></figcaption></figure>
