2d Pixel Perfect
Sets up, diagnoses, and fixes pixel perfect 2D rendering with PixelPerfectCamera in URP...
Install
npx skills add Unity-Technologies/skills --skill 2d-pixel-perfect -g -a claude-code -y- Repository
- Unity-Technologies/skills1.2k
- Category
- Engineering
- Updated
- 5d ago
- License
- See repository
- Context cost
- Mediumabout 2,402 tokens
- Runs scripts
- No, instructions only
What it does
Sets up, diagnoses, and fixes pixel perfect 2D rendering with PixelPerfectCamera in URP or Built-in. Use when a retro-style or pixel art 2D game looks blurry, jittery, or misaligned. Not for HD 2D or high-resolution art.
Set up, diagnose, and fix pixel perfect 2D rendering in Unity projects.
⚠ There Are Two Completely Separate Implementations
Pixel perfect rendering in Unity is not one system, it is two separate, incompatible implementations, one per render pipeline. Always detect the pipeline before writing or diagnosing any code.
| URP | Built-in | |
|---|---|---|
| Component | UnityEngine.Rendering.Universal.PixelPerfectCamera | UnityEngine.U2D.PixelPerfectCamera |
| Package | Built into URP, no extra install | com.unity.2d.pixel-perfect v6.0.0+ |
| API style | Enums (gridSnapping, cropFrame) | Booleans (pixelSnapping, upscaleRT, cropFrameX/Y) |
Do not install com.unity.2d.pixel-perfect in a URP project.
→ Always call DetectPipeline() first (references/pipeline-detection.cs), then branch your setup, diagnostics, and fixes based on the result.
When NOT to use this skill
- HD 2D or high-resolution 2D games, pixel snapping and point filtering will make smooth art look wrong
- UI-only scenes, use Canvas Scaler instead
- HDRP projects, Pixel Perfect Camera is not supported
Critical Reminders
⚠ Detect the render pipeline first, URP and Built-in use different Pixel Perfect Camera components that are not interchangeable. ⚠ Filter Mode = Point is the #1 fix, bilinear filtering is Unity's default and is almost always the cause of blurry sprites. ⚠ Anti-Aliasing must be disabled, in Quality Settings and on the camera. AA actively blurs pixel edges.
Key Principles
1. Pipeline Detection & Camera Component Selection
See the two-path comparison table at the top of this file. Assembly name note: the standalone Built-in package installs into a Runtime/ folder, but the asmdef "name" field is Unity.2D.PixelPerfect, no Runtime suffix. HDRP is unsupported, see the HDRP fallback section under Common Issues.
