Build your own GameObject Caster
Let’s see how convert an existing gameObject into a shadow caster.
I’ll use a cube for this example.
Start by doing the following:
Create a 3d Cube GameObject (GameObject → Create other → Cube)
Delete any collider that the GameObject has, in this case we’ll remove the BoxCollider.
Create an empty GameObject and make it a child of the Cube GameObject you created in step 1.
Add a PolygonCollider2D component to the child GameObject
Make sure you adjust the PolygonCollider2D to match the Cube if it doesn’t do it already.
Make you sure to set the Z position to the same GameObject Z position. Why? Because it needs to be aligned between the Light and the Collider so the raycasting actually hits it.
Check that the Layer in the 2DLight gameObject is in the desired Layer e.g my desired layer is “ShadowLayer” (Default = ShadowLayer)
The GameObject is ready to work with 2DDL.