> For the complete documentation index, see [llms.txt](https://docs.candy-smith.com/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.candy-smith.com/main/match-3-kit-home-design/customization/sprites-shadow.md).

# Sprites shadow

## Adding a Projected Shadow to a Sprite

Use `SpriteProjectedShadow` when a sprite needs a simple projected shadow that works correctly with simple sprites and sprites packed into a texture atlas.

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

### How It Works

`SpriteProjectedShadow` creates a child GameObject under the source sprite object.\
The child object contains its own `SpriteRenderer` and uses the `Projected Shadow` material.

The shadow renderer always uses the same sprite as the source renderer, so animated sprites are supported. The shadow shader samples the original sprite UVs directly and moves the shadow in the vertex shader. This avoids reading neighboring sprites from the atlas.

### Setup

1. Select the GameObject that has the source `SpriteRenderer`.
2. Add the component:

   `SpriteProjectedShadow`
3. The component will automatically:
   * find the source `SpriteRenderer`;
   * create a child object named `__ProjectedShadow`;
   * add a `SpriteRenderer` to the child object;
   * assign `Assets/HomeDesignMatch3Kit/Materials/Projected Shadow.mat`;
   * copy the source sprite, color, flip settings, mask interaction, and sorting settings.
4. Adjust the shadow material if needed:

   `Assets/HomeDesignMatch3Kit/Materials/Projected Shadow.mat`

### Sorting

The shadow is rendered behind the source sprite by default.

The component uses:

```csharp
sortingOrderOffset = -1;
```
