Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Renderer 2D asset reference for URP

Explore the properties and settings of the 2D Renderer Data Asset to customize the 2D lighting features.
Read time 5 minutesLast updated 15 days ago

Explore the properties and settings you can use to change how 2D lights apply to 2D GameObjects in the Universal Render Pipeline (URP).

Filtering

Property

Description

Layer MaskSets the layers that 2D GameObjects must be assigned to in order to be rendered. For more information, refer to Tags and layers.

General

Property

Description

Transparency Sort ModeSets the method Unity uses to calculate the depth of 2D GameObjects for sorting. This property has transparency in its name because Unity renders 2D objects during the transparent render pass. For more information, refer to Sort sprites.

The options are:
  • Default: Sorts using Perspective or Orthographic, depending on the Projection property of the camera.
  • Perspective: Calculates the depth of an object as the distance between the 2D object and the center point of the camera. Use this option for isometric games.
  • Orthographic: Calculates the depth of an object as the distance between the 2D object and the camera plane. Use this option for top-down games.
  • Custom Axis: Uses a custom axis to calculate depth.
Transparency Sort AxisSets the axis Unity uses to calculate the depth of 2D GameObjects. For example, if you set the Y value to 1, Unity renders a GameObject behind another if it's higher up the screen. This property is available only if you set Transparency Sort Mode to Custom Axis.
Default Material TypeSets the material Unity assigns to new sprites. The options are:
  • Lit: Assigns the 2D/Sprite-Lit-Default material. 2D lights affect this material.
  • Unlit: Assigns the 2D/Sprite-Unlit-Default material. 2D lights don't affect this material.
  • Custom: Assigns a custom material.
Default Custom MaterialSets the custom material Unity assigns to new sprites. This property is available only if you set Default Material Type to Custom.
Depth/Stencil BufferEnables Unity rendering to the depth/stencil buffer. Disabling this property can improve performance, especially on mobile platforms. Only disable this setting if you don't use features that require the depth/stencil buffer, for example masking sprites.
HDR Emulation ScaleSets the multiplier that Unity uses to emulate high-intensity lights on platforms that don't support HDR. Set this value to the combined maximum brightness of the lights in the scene, and reduce the value if there are visible bands of lit color.

Light Render Textures

The properties in this section let you control the textures Unity renders lights to before it renders 2D GameObjects. For more information, refer to Introduction to the 2D lighting system in URP.

Property

Description

Render ScaleSets the resolution of light textures as a percentage of the screen resolution. The default is 0.5.
Max Light Render TexturesSets the maximum number of light textures Unity creates and uses at one time. The default is 4. For more information, refer to Optimize 2D lights.
Max Shadow Render TexturesSets the maximum number of shadow textures Unity creates and uses at one time. The default is 1.

Light Blend Styles

The properties in this section let you customize the Blend Style property of a 2D light component. Each section corresponds to an option in the Blend Style property.
When you create a light, it automatically uses the first blend style.

Property

Description

NameSets the name of the blend style.
Mask Texture ChannelSets the channel of the mask map of the sprite that determines which areas receive light. The options are:
  • Red: Lights affect pixels if the red value in the mask map is greater than 0.
  • Green: Lights affect pixels if the green value in the mask map is greater than 0.
  • Blue: Lights affect pixels if the blue value in the mask map is greater than 0.
  • Alpha: Lights affect pixels if the alpha value in the mask map is greater than 0.
  • One Minus R: Lights have the opposite effect to Red.
  • One Minus G: Lights have the opposite effect to Green.
  • One Minus B: Lights have the opposite effect to Blue.
  • One Minus A: Lights have the opposite effect to Alpha.
For more information, refer to Add a normal map or a mask map to a sprite in URP.
Blend ModeSets the blend mode that the blend style uses. The options are:
  • Additive: Adds the color of the light to the color of the background.
  • Multiply: Multiplies the color of the light with the color of the background.
  • Subtractive: Subtracts the color of the light from the color of the background.
For more information, refer to Blend Modes in 2D lighting.

Camera Sorting Layer Texture

The properties in this section let you capture the camera color buffer after Unity renders a certain number of sorting layers, so you can use it in a custom shader. For more information, refer to Sprites sorting order.

Property

Description

Foremost Sorting LayerSets the last sorting layer Unity includes when it captures the camera color buffer and stores it in a
CameraSortingLayerTexture
shader variable. Select Disabled to prevent Unity capturing the camera color buffer.
Downsampling methodReduces the resolution of the
CameraSortingLayerTexture
texture. The options are:
  • None: Doesn't reduce the resolution.
  • 2x Bilinear: Reduces the resolution by half using bilinear filtering.
  • 4x Box: Reduces the resolution to a quarter using box filtering.
  • 4x Bilinear: Reduces the resolution to a quarter using bilinear filtering.

Post-processing

Property

Description

EnabledEnables post-processing effects in your scene. If disabled, Unity excludes post-processing renderer passes, shaders, and textures from the build. For more information, refer to Post-processing in URP.

Additional resources