For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

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:

Last updated