Skip to content

VFX in a 2D Unity Game with URP's 2D Renderer

The Particle System works in a 2D game: its particles sort with your sprites like any other renderer, and fires, slashes and hits look the same in a side view as in 3D. What changes under URP’s 2D Renderer is that it makes no depth or opaque texture, so the effects that read one of those have nothing to read, and its 2D lights only reach materials built for them.

A 2D scene of mountains, grass and a space soldier under URP's 2D Renderer, with a fire burning in front, a sword slash sweeping and a fire impact bursting, all drawn over the sprites
  • Sorting. A Particle System’s Renderer module has a Sorting Layer and an Order in Layer, like a Sprite Renderer. Give the particles a higher order than the sprites they should cover, and a lower one to sit behind them.
  • Keep it flat. Particles face the camera on their own, but they still fly in 3D. Turn the Shape module’s emitter so it emits in the X and Y plane, or particles drift towards or away from a side view camera and look slower than they are.
  • Collisions with 2D colliders. The Collision module’s World type has a 2D mode for colliders made with Physics 2D.
  • The renderer. A project from Unity’s 2D URP template uses a Renderer 2D asset in its URP asset. Unlit particle materials draw the same under it as under the Universal Renderer.

Soft particles, an intersection glow and screen distortion. In URP, soft particles and intersection glows read the camera’s depth texture, and screen distortion reads its opaque texture, a copy of the image taken after the opaque objects. The 2D Renderer makes neither.

In a scene of sprites that matters less than it sounds, because sprites are transparent: they write no depth and never enter the opaque texture, which holds only opaque objects. So in URP, screen distortion over sprites does not bend them on either renderer. Tested with a distortion ring over the demo’s soldier: on the Universal Renderer the ring showed the opaque texture’s own contents instead of the soldier behind it, and on the 2D Renderer it bent nothing. Soft particles likewise have no sprite depth to fade against.

For heat haze or a shockwave that bends sprites, the 2D Renderer has its own source: its Camera Sorting Layer Texture, a copy of everything drawn up to a sorting layer you choose, which a shader of your own can read and bend.

2D lights. The 2D Renderer’s lights reach only materials whose shader has its 2D lighting pass, such as URP’s 2D Sprite Lit shaders. Everything else is drawn unlit. For glowing effects such as fire and magic that is usually what you want; a particle that should be lit by 2D lights needs a 2D lit material.

Don’t own it yet? → Get it on the Unity Asset Store

For a project on the 2D Renderer, follow the URP setup on Setup and Render Pipelines and import the Import2DRenderer package where it says. It brings the same URP shader as the URP package, with the demo’s materials adjusted: Soft Particles, Screen Distortion and most Intersection Glow are turned off, since the 2D Renderer cannot draw them. The setup page’s Disable Depth And Scene Color effects button does the same for your own materials.

Every other effect works under the 2D Renderer: the shapes and their distortion, fades and dissolves, colour ramps, glows (with Bloom on the camera) and the rest. Good prefabs to start from are the demo’s fires (Real Fire, Pixel Fire, Blue Fire), slashes, projectiles and impacts; the slash, trail and hit guide walks through the last three. The prefabs ship with every renderer at Order in Layer 0, so set it on each Particle System’s renderer to place them against your sprites.

The VFX Toolkit’s shaders are unlit, so 2D lights do not light them. The Fake Light And Shadow effect shades particles from a direction that its AllIn1VfxFakeLightDirSetter component sets, rather than from scene lights, if you want light and shadow on them anyway. See Effects and Properties Breakdown.

The Sprite Shader or the VFX Toolkit for a 2D game? They do different jobs. All In 1 Sprite Shader puts effects on the sprites themselves: an outline on a character, a hit flash, a dissolve, a glow. The VFX Toolkit makes the effects that happen around them: fire, slashes, impacts, projectiles, magic. A 2D game often uses both.

The VFX Toolkit’s materials also work on UI Images, for an animated icon or a glowing button; see First Steps. Images that share a material share its look, so give each its own copy to change one alone, as How to Animate Materials explains.

A Mask or Rect Mask 2D does not clip them: the VFX Toolkit’s shaders have no UI masking support, so an Image inside a Scroll View draws past its edges. Keep VFX materials on UI outside masked areas.

A Particle System is not a UI element, so it does not show on a Screen Space Overlay canvas. For particles over UI, use a Screen Space Camera canvas and give the particles a higher Order in Layer than the canvas.

  • Soft Particles, Intersection Glow and Screen Distortion under the 2D Renderer, which makes no depth or opaque texture for them.
  • 2D lights. The shaders are unlit; Fake Light And Shadow is the stand in.
  • UI masking. A Mask or Rect Mask 2D does not clip the VFX Toolkit’s materials.