Introduction to 2D lighting in URP
Understand the tools and runtime components to create a lit 2D scene with 2D lighting features.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前
Add 2D lights to scenes to light 2D GameObjects such as sprites, tilemaps, and sprite shapes in the Universal Render Pipeline (URP).
Types of 2D light
There are four types of 2D light:
- 2D spot light: Emits light from a point in a specific direction with a cone-shaped area of effect.
- 2D sprite light: Emits light in the shape of a sprite.
- 2D freeform light: Emits light as a custom polygon shape that you can edit.
- 2D global light: Lights all 2D GameObjects equally with no attenuation. You can only use one global light per blend style and sorting layer.

Left: A 2D spot light in the Editor window. Right: The resulting light effect. The sprite is lit from one direction.

Left: A 2D sprite light in the Editor window. Right: The resulting light effect. The sprite is lit in the shape of the selected sprite.

Left: A 2D freeform light in the Editor window. Right: The resulting light effect. The object is lit by the polygon shape of the Freeform Light.
How Unity renders 2D lights
Unity renders 2D lights and shadows in three stages:
- Draws the shapes of 2D shadows into one or more shadow textures.
- Draws the color and shape of each 2D light into one or more light textures.
- Renders the lit GameObjects onto the screen, using the information from the textures.
By default, Unity tries to render all the light and shadow textures before it renders any GameObjects into the scene. This approach improves performance, because Unity avoids alternating between rendering to the textures and rendering to the screen.
For more information, refer to Optimize 2D lights with batching.