
2d-pixel-perfect
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.
- Installs
- 45
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/unity-technologies/unity-agent-plugin --skill 2d-pixel-perfect- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads 2d-pixel-perfect automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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.
→ Code: references/pipeline-detection.cs — DetectPipeline(), GetPixelPerfectCameraType(), and migration mismatch check.
2. Diagnostic-First Approach
Always diagnose before making changes. Report findings, then fix only what is broken.
3. Work in the correct scope
Default to scene scope. Scan project-wide only when the user explicitly requests it.
Diagnostic Checklist
Sprite import settings:
- Filter Mode =
Point (no filter)on all in-scope sprites - Mip Maps = disabled
- Compression =
None/ Uncompressed - PPU consistent across all sprites in scene
- Sprite pivots set to Custom / Pixels mode — a center pivot on an odd-dimension sprite (e.g. 15×15) lands at 7.5px, causing 0.5px misalignment
→ Code: references/sprite-settings.cs — GetImporter() and FixSpriteImportSettings().
Editor snap settings:
- Grid Size =
1 / assetsPPUon all axes (e.g. PPU 16 → 0.0625, PPU 100 → 0.01) - Grid Snapping enabled in the Grid and Snap overlay
- To snap existing GameObjects: select them → Align Selected → All Axes
Camera setup:
- Camera projection = Orthographic
- Pixel Perfect Camera component present and correct type for pipeline
-
allowHDR,allowMSAA,allowDynamicResolutionallfalse - Scene view shows two green bounding boxes on the camera gizmo — solid = visible area, dotted = reference resolution
→ Code: references/camera-setup-urp.cs — full URP camera + PP Camera configuration.
→ Code: references/camera-setup-builtin.cs — Built-in standalone configuration.
Project quality settings:
- Anti-Aliasing = 0 in Quality Settings
- Anisotropic Filtering = Disabled
API Reference
Full property/method tables, GridSnapping and CropFrame enum values, and recommended configurations:
→ references/api-reference.md — read this when writing or reviewing camera setup code.
Quick enum summary:
GridSnapping: None · PixelSnapping (standard) · UpscaleRenderTexture (authentic low-res; incompatible with post-processing and UI text)
CropFrame: None · Pillarbox · Letterbox · Windowbox (safest default) · StretchFill
Reference Resolution
Choose before building any assets. Never change after asset production starts.
| Reference resolution | 1080p | 1440p | 4K |
|---|---|---|---|
| 320 × 180 | 6× | 8× | 12× |
| 480 × 270 | 4× | ~5.3× | 8× |
| 640 × 360 | 3× | 4× | 6× |
320×180 is the safest general choice. For screens with no integer fit (e.g. 1366×768), use cropFrame = Windowbox to add black bars rather than stretching to a fractional scale.
Migration & Compatibility
URP project with the Built-in standalone component
Symptom: DetectPipeline() returns URP but camera has UnityEngine.U2D.PixelPerfectCamera. Symptoms are subtle because the standalone component has ENABLE_URP conditional code.
Fix:
- Remove
com.unity.2d.pixel-perfectfrom Package Manager - Remove
UnityEngine.U2D.PixelPerfectCamerafrom each camera - Add
UnityEngine.Rendering.Universal.PixelPerfectCamera - Reconfigure — booleans (
pixelSnapping,upscaleRT,cropFrameX/Y) become enums (gridSnapping,cropFrame)
→ Detection code: references/pipeline-detection.cs (bottom of file).
Old URP namespace (pre-Unity 2022 / URP pre-13.x)
Symptom: Compiler errors referencing UnityEngine.Experimental.Rendering.Universal.
Fix: Replace using UnityEngine.Experimental.Rendering.Universal; with using UnityEngine.Rendering.Universal;. Update any assembly-qualified type strings. The [MovedFrom] attribute handles serialization automatically — components on GameObjects survive the upgrade.
Common Issues & Solutions
Blurry sprites
Fix: Set Filter Mode to Point on all in-scope sprites, disable Mip Maps, disable AA in Quality Settings.
→ Code: references/sprite-settings.cs
Tilemap gaps between tiles
Work through in order — workarounds like negative cell gap or PPU = 31.99 break when the camera moves.
| # | Check | Fix |
|---|---|---|
| 1 | Sprite Atlas with Tight Packing off, Padding ≥ 4, Sprite Packer Mode enabled? | Enable Sprite Packer Mode in Editor settings; on the atlas set Padding ≥ 4 and turn Tight Packing off |
| 2 | Mipmaps disabled on tileset textures and atlas? | Disable Generate Mip Maps |
| 3 | AA = 0, MSAA off on camera? | Disable AA globally |
| 4 | Compression = None? | RGBA 32-bit uncompressed |
| 5 | All tile sprites have even pixel dimensions? | Odd dimensions cause 0.5px grid offset |
| 6 | PPU = tile pixel width? (16×16 → PPU 16) | PPU mismatch leaves physical gaps |
| 7 | Gaps only during camera movement after all above pass? | Use PP Camera pixel snapping; do not use cellGap = -0.01f |
Cinemachine conflict
Cause: Both Cinemachine and the Pixel Perfect Camera write to orthographic size every frame.
Fix: Add CinemachinePixelPerfect extension via the Add Extension dropdown on each Virtual Camera. Do not add it via AddComponent in code.
Known limitations:
- Camera blends between virtual cameras are not pixel-perfect during transitions
UpscaleRenderTexturereduces valid pixel-perfect ortho sizes, which may cause framing to deviate- Target Group + Framing Transposer causes visible choppiness (no fix available)
Post-processing blur with upscaleRT
Cause: Post-processing runs after the PP Camera upscales the render texture.
Simple fix: Disable upscaleRT. Post-processing then runs at native screen resolution.
Advanced fix (Unity 6 URP): Inject a ScriptableRendererFeature2D at RenderPassEvent2D.AfterRenderingPostProcessing. Use 2D-specific base classes — ScriptableRendererFeature (3D base class) is silently ignored in a URP 2D renderer.
UI text blurry with upscaleRT
Status: Known Unity bug, declined to fix (still present Unity 6, 2025).
Root causes: (A) Canvas renders into the low-res buffer and is upscaled with the scene. (B) TMP's SDF gradient threshold is miscalibrated at low reference resolutions.
Fixes in order of reliability:
Screen Space - Overlayon Canvas — bypasses the camera, renders at native resolution- Dedicated UI camera with no PP Camera component,
Screen Space - Cameramode - Unity 6 only:
Font Material → Debug Settings → Sharpness = 1(mitigates B, not A)
Physics / render desync (micro-stutter)
Cause: Physics runs at a fixed timestep; interpolated positions produce fractional values that snap to different pixels each frame.
Fix:
- Enable
Rigidbody2D.interpolation = RigidbodyInterpolation2D.Interpolateon physics-driven sprites - Set
Time.fixedDeltaTime = 1f / 60fto match target frame rate - Keep camera tracking in
LateUpdate, notFixedUpdate
Non-integer scaling / pixel decimation
Cause: Screen resolution is not a clean integer multiple of the reference resolution.
Fix: Choose a reference resolution from the table above. Use cropFrame = Windowbox when no integer fit exists.
Missing URP 2D Renderer
Fix:
Assets > Create > Rendering > URP 2D Renderer Data- Assign it to your URP Asset under Renderer List
- Requires
com.unity.render-pipelines.universal12.0+
HDRP fallback
Pixel Perfect Camera is unsupported in HDRP.
Built-in / Unity 5.x: Use RenderTexture + Graphics.Blit with FilterMode.Point.
Unity 6 URP: Use ScriptableRendererFeature2D + ScriptableRenderPass2D injected at RenderPassEvent2D.AfterRendering with AddRasterRenderPass. Note: OnRenderImage and Graphics.Blit are incompatible with Unity 6's render graph.
FAQ
What does the 2d-pixel-perfect skill do?
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.
How do I install 2d-pixel-perfect?
Run npx skills add https://github.com/unity-technologies/unity-agent-plugin --skill 2d-pixel-perfect in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/2d-pixel-perfect/ (personal) or .claude/skills/2d-pixel-perfect/ (project).
Which AI agents can use 2d-pixel-perfect?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is 2d-pixel-perfect safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains 2d-pixel-perfect?
It is published by unity-technologies in unity-technologies/unity-agent-plugin. It has 45 recorded installs.
More from unity-technologies/unity-agent-plugin
unity-cli
unity-technologies/unity-agent-plugin
Controls the Unity Editor and projects from the command line, driving a running Editor to edit scenes and assets or run C. Use when asked to install or manage Editors, licenses, or projects, set up version control, build, test, configure the Unity MCP server, or run any unity command.
urp-postprocessing
unity-technologies/unity-agent-plugin
Sets up, configures, and debugs URP post-processing with the Volume framework. Use for bloom, tonemapping, color adjustments, depth of field, vignette, or other Volume overrides.
ui-ugui
unity-technologies/unity-agent-plugin
Understands, edits, and generates Unity uGUI Canvas hierarchies, RectTransforms, Layout Groups, and prefab UI. Use for requests involving Canvas, uGUI, RectTransform, or prefab UI files.
unity-package-management
unity-technologies/unity-agent-plugin
Adds, removes, upgrades, and discovers Unity (UPM) packages from outside the Editor, with the Pipeline package commands first and a C script as the fallback. Use for package installs, verifying package IDs and versions, or choosing which packages a game needs.
ui-uitk
unity-technologies/unity-agent-plugin
Open the skill to read its SKILL.md instructions.
localization
unity-technologies/unity-agent-plugin
Sets up and configures Unity Localization, including locales, String and Asset Tables, and CJK fonts. Use when the user asks to add languages, translate UI text, or mentions i18n or multilingual support.
Popular media & creative skills
hyperframes
heygen-com/hyperframes
Read first to make, edit, animate or render any video with HyperFrames (HTML rendered to video), including launch films, explainers, music videos, charts, maps, vertical clips, title cards, captions and overlays. Holds the render contract, the work loop and what each kind of video needs.
media-use
heygen-com/hyperframes
Get or make any media for a HyperFrames video - music, sound effects, images, icons, logos, voiceover, avatar and generated video, transcripts, cutouts, colour grades and looks - with HeyGen or free local tools, and mix placed audio. Also for footage that looks dark, flat or dull, or should be stylized or hidden.
hyperframes-registry
heygen-com/hyperframes
About 450 ready-made HyperFrames blocks and components installed as editable source - transitions, overlays, titles, kinetic type, captions, charts, map overlays, 3D, camera moves. Use it before hand-building any named visual (CRT scanlines, glitch, film grain, a chart); also for hyperframes add and catalog.
hyperframes-creative
heygen-com/hyperframes
Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use hyperframes-animation.
ai-video-generation
101-skills/superpowers
Generate AI videos with Google Veo, Seedance 2.0, HappyHorse, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 2.0, HappyHorse 1.0, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, reference-to-video, video editing, lipsync, avatar animation, video upscaling, foley sound. Use for: social media videos, marketing content, explainer videos, product demos, AI avatars. Triggers: video generation, ai video, text to video, image to video, veo, animate image, video from image, ai animation, video generator, generate video, t2v, i2v, ai video maker, create video with ai, runway alternative, pika alternative, sora alternative, kling alternative, seedance, happyhorse
ai-image-generation
101-skills/superpowers
Generate AI images with GPT-Image-2, FLUX, Gemini, Grok, Seedream, Reve and 50+ models via inference.sh CLI. Models: GPT-Image-2, FLUX Dev LoRA, FLUX.2 Klein LoRA, Gemini 3 Pro Image, Grok Imagine, Seedream 4.5, Reve, ImagineArt. Capabilities: text-to-image, image-to-image, inpainting, LoRA, image editing, upscaling, text rendering. Use for: AI art, product mockups, concept art, social media graphics, marketing visuals, illustrations. Triggers: flux, image generation, ai image, text to image, stable diffusion, generate image, ai art, midjourney alternative, dall-e alternative, text2img, t2i, image generator, ai picture, create image with ai, generative ai, ai illustration, grok image, gemini image, gpt image, openai image, chatgpt image