In a 2D project, URP contains multiple injection points that let you inject render passes into the 2D frame rendering loop and execute them upon different events.
Injection points give a custom render pass access to URP buffers. A render pass has read and write access to all buffers at each injection point.
Unity provides the following events in the RenderPassEvent2D API. You can use these events to inject your custom passes.
| Injection point | When URP executes the render pass | Render to specific sorting layer |
|---|---|---|
BeforeRendering |
Before any other passes in the pipeline for the current camera. Unity hasn’t set up camera matrices and stereo rendering at this point. You can use this injection point to draw to custom input textures used later in the pipeline, for example Look-Up Table (LUT) textures. | No |
BeforeRenderingNormals |
Before URP renders normal maps in the Normal2D pass. | Yes |
AfterRenderingNormals |
After URP renders normal maps. | Yes |
BeforeRenderingShadows |
Before URP renders shadows in the Shadow2D pass. | Yes |
AfterRenderingShadows |
After rendering shadows. | Yes |
BeforeRenderingLights |
Before URP renders lighting in the Light2D pass. | Yes |
AfterRenderingLights |
After URP renders lighting. | Yes |
BeforeRenderingSprites |
Before URP renders sprites in the Renderer2D pass. | Yes |
AfterRenderingSprites |
After URP renders sprites. | Yes |
BeforeRenderingPostProcessing |
Before URP renders post-processing effects in the RenderPostProcessingEffects pass. | No |
AfterRenderingPostProcessing |
After URP renders post-processing effects, but before the final blit, post-processing anti-aliasing effects, and color grading. | No |
AfterRendering |
After all other passes. | No |
Note: If you render to activeColorTexture in the BeforeRenderingSprites or AfterRenderingSprites injection points, rendering affects all sorting layers behind and up to the specified sorting layer.