Search code examples
c#unity-game-engine2dlighting

How do you make 2D shadows in Unity?


I tried to make 2D shadows by adding a spotlight like in this tutorial: https://www.youtube.com/watch?v=nvbQ9_bzx1k I put a spotlight and tried using a different render pipeline but nothing works. Can someone help with a simple technique?


Solution

  • You could use Unity's experimental 2D Renderer with 2D lights and the Shadow Caster 2D Component

    Here is a Brackeys video about 2D Renderer and 2D lights: https://www.youtube.com/watch?v=nkgGyO9VG54&t=557s&ab_channel=Brackeys

    The Documentation to the Shader Caster 2D Component: https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@7.1/manual/2DShadows.html

    You could also use this Asset without getting deep into the 2D Rendering.

    https://assetstore.unity.com/packages/tools/particles-effects/hard-light-2d-152208