How to block a light source in 2D

I am making a top down game in 2D that uses unitys lights. I had a simple system of putting walls on a higher Z layer than the floor so they are not lit by a light, which works fine, but another floor is on the other side of the room, the light will light that room too.

I tried placing colliders, 3D cubes, Planes etc. under the wall tile but nothing seems to occlude or block the light from shining through it.

Is there any way to achieve this?

Here is the problem, you can see the light shining through the wall (well, technically under it)


Here is how the scene is structured in terms of Z layer

So here is an image showing how the walls are higher up on the Z plane, so they arent lit by the light, and my attempt at putting in a 3D cube to block the light, but it still passes through and lights up the sprite on the other side

I assume that this is either not possible, or I am doing something very stupid indeed!

The sprites are using the standard shader, and the light has been set to cast shadows and not cast them, makes no difference.

Anyone have any ideas on how to solve this?

Lights are one thing, shadows are another. You basically are in need of some kind of shadow system i.e. where light is blocked by objects. Lights are calculated based on proximity to the light source and pay no attention to anything getting in the way.

Thanks, apologies for the delay in reply, I’ve been away.

I kind of figured that was the case, I’ll try using a 3d Block under the wall, and creating a shader that recieves shadows for the sprites, and see if thats a good workaround