- Home /
Unity Lighting in 2D, block light source
I'm making a 2D game in Unity, and I want to have characters walking around with flashlights. I've set the 2D sprites to a a Sprites/Diffuse material so they can using unity's lighting system. I want the flashlights to have a realistic lighting effect, in that they can't shine through walls onto other tiles.
I've created a Spot light that uses 'Hard Shadows'. (Pictured Below).
To illustrate my problem, I've created some cubes to show that the light correctly works with these 3D cubes, in that the light is blocked properly. However, you can see that the light passes through the cube and illuminates the 2D floor sprites PAST the cube.
Looks like a problem with orthogonal planes not getting the hard shadows from the cubes.
Is there any way to use Unity's 3D lighting to properly make walls so light doesn't go through objects? (I've looked at assets in the asset store, the free ones aren't very good and require changing a lot of things).
Your answer
![](https://koobas.hobune.stream/wayback/20220612124902im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Light and 2D Sprite overlapping issue 1 Answer
I can't use 2D lights 2 Answers
How to achieve this flat 2D lighting effect? 3 Answers
Casting sharp 2D shadows side on 0 Answers
[2D] Is it possible to create a collider for 2D lights? 0 Answers