Loading lessons...
2D Graphics & URP
2D Graphics & URP
Modern Unity 2D uses the Universal Render Pipeline (URP) to achieve advanced graphical results, including dynamic 2D lighting and shadows.
URP 2D Renderer
When you set up a URP project with a 2D Template, the pipeline compiles using the 2D Renderer:
- This enables 2D Lights to illuminate sprite textures.
- It supports Normal Maps on sprites to generate realistic 2D lighting depth.
Types of 2D Lights
You add 2D lights via GameObject -> Light -> 2D:
- Global Light 2D: Shines on all sprites in the scene (acts as ambient light).
- Spot Light 2D: Emits a cone or circle of light from a source point.
- Point Light 2D: Emits light in a circular shape.
- Freeform Light 2D: Allows editing a polygon outline path to cast custom light shapes.
Sprite Shadow Receiver & Caster
To enable shadows in 2D:
- Add a Shadow Caster 2D component to a GameObject (like a wall sprite).
- Define its shadow-casting boundary outline.
- Configure the 2D Light component to enable shadows. The light will cast soft shadow shapes behind the caster.
Sprite Shape
Sprite Shape is a tool that tiles a sprite texture along a vector path.
- Used for drawing organic terrain, hills, paths, or circular platforms.
- You edit node handles in the scene to deform the path shape, and the texture stretches and tiles automatically.
TL;DR
- URP's 2D Renderer supports dynamic lights, shadows, and materials in 2D.
- Global, Spot, Point, and Freeform are the main 2D Light types.
- Shadow Caster 2D generates dynamic shadows when hit by 2D Lights.
- Sprite Shape dynamically bends sprite assets along editing node lines.