Quick answer: ShadowCaster2D bakes its shape from the collider when it’s set to “Use Collider”. After changing the collider at runtime, re-bake by toggling the component or setting the shape path explicitly.
A destructible wall’s collider shrinks when damaged, but its 2D shadow stays the original full size — the ShadowCaster2D shape didn’t follow.
The Shape Is Baked
With “Use Collider” enabled, ShadowCaster2D reads the collider’s shape once (on enable / when set in the editor). Runtime collider changes don’t auto-propagate.
Re-Bake After a Change
void OnColliderChanged()
{
var caster = GetComponent<ShadowCaster2D>();
caster.enabled = false;
caster.enabled = true; // forces a re-bake from the collider
}
Toggling the component re-reads the collider. It’s a blunt instrument but reliable for occasional changes (destruction, doors).
Custom Shape Path
For fully dynamic shapes, drive the ShadowCaster2D’s shape path directly instead of “Use Collider” — set the points each time the silhouette changes. More control, more code.
Static Casters Stay Static
Most level geometry never changes — leave those as baked “Use Collider” casters. Only the genuinely-dynamic ones need re-baking, so the cost is small.
Verifying
Damage the wall — both its collider and its cast shadow shrink together. Static walls keep casting correctly with zero per-frame cost.
“ShadowCaster2D bakes from the collider once. Toggle it to re-bake after a runtime collider change.”
Don’t toggle it every frame — re-bake only on the actual change event, or shadow updates will eat your frame budget.