Quick answer: A ShadowCaster2D needs a generated polygon shape, the parent Light 2D needs Shadow Strength greater than 0, and the caster’s sorting layer must be in the light’s Target Sorting Layers list. Click Generate Shape on the caster to seed its polygon if it is empty.

Here is how to fix Unity URP ShadowCaster2D components that fail to block their accompanying 2D Lights. You add a Light 2D for a torch, place ShadowCaster2D on the walls, and the light passes through the walls as if nothing was there. The 2D shadow system has three independent requirements that all must be true at once.

The Symptom

2D Lights illuminate the scene correctly. ShadowCaster2D components are present on walls or characters. But the lights pass through casters with no shadow effect. The Scene view’s gizmo for the caster shape is either invisible or shows a tiny red outline.

What Causes This

No generated shape. ShadowCaster2D needs a polygon to define its silhouette. Unity does not auto-generate one from sprites; you must click Generate Shape in the inspector or assign a shape from a Collider2D.

Shadow Strength is 0. Each Light 2D has a Shadow Strength slider. The default is 0, meaning shadows are not cast at all even when casters are present.

Sorting layers do not match. 2D Lights only affect (and receive shadows from) sprites in their Target Sorting Layers. If the caster is on layer Default but the light targets Foreground, no shadow is cast.

Composite caster setup wrong. If you have many small caster shapes under a parent, you may want a CompositeShadowCaster2D. Without it, each caster works alone, which can produce gaps.

The Fix

Step 1: Generate the caster shape. Select the GameObject with ShadowCaster2D. In the inspector click Generate Shape. The polygon should appear as a yellow outline in the Scene view. If the shape is wrong, edit it in the Sprite Editor or attach a PolygonCollider2D and toggle Use Renderer Silhouette.

Step 2: Raise Shadow Strength on the light. Select the Light 2D, find Shadow Strength in the inspector, and set it between 0.5 and 1.0. Values near 1 produce hard, fully opaque shadows; values below 0.5 are subtle.

Step 3: Add caster sorting layer to the light’s Target Sorting Layers. On the Light 2D inspector, expand Target Sorting Layers and ensure the layer your caster sits on is listed.

Step 4: Add a CompositeShadowCaster2D for grouped casters.

// Hierarchy:
// WallGroup (CompositeShadowCaster2D)
//   Wall1 (ShadowCaster2D)
//   Wall2 (ShadowCaster2D)
//   Wall3 (ShadowCaster2D)

The composite stitches child shapes into a single caster, eliminating gaps where adjacent casters meet.

Step 5: Enable Self Shadows for solid objects. On the caster, check Self Shadows if the object should appear darker on the side facing away from the light. Leave unchecked for thin objects where you want the silhouette without dimming the object itself.

Verifying the Setup

In the Scene view, drag a 2D Light around the caster. You should see the shadow polygon project away from the light source, with darkened cells where the shadow falls. If you see no projection at all, the issue is shape, strength, or layer — check those three first.

// Quick runtime check
using UnityEngine;
using UnityEngine.Rendering.Universal;

public class ValidateShadowSetup : MonoBehaviour
{
    void Start()
    {
        var caster = GetComponent<ShadowCaster2D>();
        if (caster == null || caster.shapePath.Length < 3)
            Debug.LogError("ShadowCaster2D missing valid polygon shape");
    }
}

Performance Considerations

Each caster contributes to per-light shadow geometry. Hundreds of small casters can hurt frame rate on mobile. Use CompositeShadowCaster2D to merge static groups, and disable shadow on lights where artistic intent does not require it.

“Shape, strength, layer. Three boxes that must all be checked. The 2D shadow system is unforgiving when any one fails.”

Related Issues

For 2D Lights not lighting at all, see 2D Light Not Affecting Sprites. For URP rendering issues, see URP Shader Not Rendering in Build.

Generate Shape. Strength > 0. Sorting layer in target list. The shadow appears.