Communitygithub.com

unity-technologies/2d-pixel-perfect

Unity 프로젝트에서 픽셀 완벽한 2D 렌더링을 설정, 진단 및 수정합니다. 레트로 스타일 또는 픽셀 아트 2D 게임 작업 시 사용하세요.

2d-pixel-perfect란 무엇인가요?

이 스킬은 Unity 프로젝트에서 픽셀 완벽한 2D 렌더링을 설정, 진단 및 수정하는 방법을 제공합니다. 주로 레트로 스타일이나 픽셀 아트 2D 게임을 개발할 때 유용하며, URP(Universal Render Pipeline)와 Built-in 렌더 파이프라인 각각에 대해 완전히 다른 두 가지 구현체를 지원합니다. 사용자는 먼저 `DetectPipeline()` 함수로 현재 프로젝트의 렌더 파이프라인을 감지한 후, 해당 파이프라인에 맞는 PixelPerfectCamera 컴포넌트(URP: `UnityEngine.Rendering.Universal.PixelPerfectCamera`, Built-in: `UnityEngine.U2D.PixelPerfectCamera`)와 설정을 적용해야 합니다. 진단 체크리스트에는 스프라이트 임포트 설정(Filter Mode = Point, Mip Maps 비활성화, 압축 없음), 에디터 스냅 설정(Grid Size = 1/PPU), 카메라 설정(Orthographic, Pixel Perfect Camera, HDR/MSAA 비활성화), 프로젝트 품질 설정(Anti-Aliasing 0) 등이 포함됩니다. 이 스킬은 또한 타일맵 간격, Cinemachine 충돌, 포스트 프로세싱 블러 등 일반적인 문제에 대한 해결책을 제공하며, 참조 해상도(예: 320×180) 선택 가이드와 마이그레이션 절차(URP + Built-in 혼용 문제 해결)도 포함하고 있습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/unity-technologies/skills/tree/main/skills/2d-pixel-perfect

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Unity 프로젝트에서 픽셀 완벽한 2D 렌더링을 설정, 진단 및 수정합니다.


⚠️ 완전히 분리된 두 가지 구현체가 있습니다

Unity의 픽셀 완벽 렌더링은 하나의 시스템이 아닙니다 — 렌더 파이프라인별로 두 개의 분리된 호환되지 않는 구현체가 있습니다. 코드를 작성하거나 진단하기 전에 항상 파이프라인을 감지하세요.

URPBuilt-in
컴포넌트UnityEngine.Rendering.Universal.PixelPerfectCameraUnityEngine.U2D.PixelPerfectCamera
패키지URP에 내장 — 별도 설치 불필요com.unity.2d.pixel-perfect v6.0.0+
API 스타일열거형 (gridSnapping, cropFrame)불리언 (pixelSnapping, upscaleRT, cropFrameX/Y)

URP 프로젝트에 com.unity.2d.pixel-perfect를 설치하지 마세요.

→ 항상 먼저 DetectPipeline()을 호출하세요 (references/pipeline-detection.cs), 그런 다음 결과에 따라 설정, 진단 및 수정을 분기 처리합니다.


이 스킬을 사용하지 말아야 할 경우

  • HD 2D 또는 고해상도 2D 게임 — 픽셀 스냅과 포인트 필터링이 부드러운 아트를 어색하게 보이게 합니다
  • UI 전용 씬 — 대신 Canvas Scaler를 사용하세요
  • HDRP 프로젝트 — Pixel Perfect Camera가 지원되지 않습니다

중요한 주의사항

⚠️ 렌더 파이프라인을 먼저 감지하세요 — URP와 Built-in은 서로 다른 Pixel Perfect Camera 컴포넌트를 사용하며 교체할 수 없습니다. ⚠️ 필터 모드 = Point가 #1 수정 방법입니다 — 쌍선형 필터링이 Unity의 기본값이며 거의 항상 스프라이트가 흐릿해지는 원인입니다. ⚠️ 안티앨리어싱을 비활성화해야 합니다 — 품질 설정과 카메라에서 모두 비활성화하세요. AA는 픽셀 가장자리를 적극적으로 흐리게 만듭니다.

주요 원칙

1. 파이프라인 감지 및 카메라 컴포넌트 선택

이 파일 상단의 두 경로 비교 표를 참조하세요. 어셈블리 이름 참고: 독립형 Built-in 패키지는 Runtime/ 폴더에 설치되지만, asmdef "name" 필드는 Unity.2D.PixelPerfect입니다 — Runtime 접미사 없음. HDRP는 지원되지 않습니다 — 일반 문제 섹션의 HDRP 대체 방안을 참조하세요.

→ 코드: references/pipeline-detection.cs — DetectPipeline(), GetPixelPerfectCameraType(), 마이그레이션 불일치 검사.

2. 진단 우선 접근법

변경하기 전에 항상 진단하세요. 결과를 보고하고, 문제가 있는 부분만 수정하세요.

3. 적절한 범위에서 작업

기본적으로 씬 범위로 작업하세요. 사용자가 명시적으로 요청하는 경우에만 프로젝트 전체를 검사하세요.


진단 체크리스트

스프라이트 임포트 설정:

  • 모든 대상 스프라이트에서 필터 모드 = Point (no filter)
  • 밉맵 = 비활성화
  • 압축 = None / 압축 없음
  • 씬 내 모든 스프라이트의 PPU 일관성
  • 스프라이트 피벗이 Custom / Pixels 모드로 설정됨 — 홀수 크기 스프라이트(예: 15×15)의 중앙 피벗은 7.5px에 위치하여 0.5px 정렬 불일치 발생

→ 코드: references/sprite-settings.cs — GetImporter() 및 FixSpriteImportSettings().

에디터 스냅 설정:

  • 모든 축의 그리드 크기 = 1 / assetsPPU (예: PPU 16 → 0.0625, PPU 100 → 0.01)
  • 그리드 및 스냅 오버레이에서 그리드 스냅 활성화
  • 기존 게임 오브젝트 스냅: 오브젝트 선택 → 정렬 선택 → 모든 축

카메라 설정:

  • 카메라 투영 = 직교(Orthographic)
  • 파이프라인에 맞는 올바른 유형의 Pixel Perfect Camera 컴포넌트 존재
  • allowHDR, allowMSAA, allowDynamicResolution 모두 false
  • 씬 뷰에 카메라 기즈모에 두 개의 녹색 경계 상자 표시 — 실선 = 가시 영역, 점선 = 참조 해상도

→ 코드: references/camera-setup-urp.cs — 전체 URP 카메라 + PP Camera 구성. → 코드: references/camera-setup-builtin.cs — Built-in 독립형 구성.

프로젝트 품질 설정:

  • 품질 설정에서 안티앨리어싱 = 0
  • 이방성 필터링 = 비활성화

API 참조

전체 속성/메서드 표, GridSnapping 및 CropFrame 열거형 값, 권장 구성: → references/api-reference.md — 카메라 설정 코드를 작성하거나 검토할 때 읽으세요.

빠른 열거형 요약:

GridSnapping: None · PixelSnapping (표준) · UpscaleRenderTexture (진정한 저해상도; 포스트 프로세싱 및 UI 텍스트와 호환되지 않음)

CropFrame: None · Pillarbox · Letterbox · Windowbox (가장 안전한 기본값) · StretchFill


참조 해상도

에셋 제작 전에 선택하세요. 에셋 제작이 시작된 후에는 변경하지 마세요.

참조 해상도1080p1440p4K
320 × 1806×8×12×
480 × 2704×~5.3×8×
640 × 3603×4×6×

320×180이 가장 안전한 일반 선택입니다. 정수 배율이 맞지 않는 화면(예: 1366×768)의 경우, 분수 배율로 늘리는 대신 cropFrame = Windowbox를 사용하여 검은색 막대를 추가하세요.


마이그레이션 및 호환성

URP 프로젝트에 Built-in 독립형 컴포넌트가 있는 경우

증상: DetectPipeline()이 URP를 반환하지만 카메라에 UnityEngine.U2D.PixelPerfectCamera가 있습니다. 독립형 컴포넌트에 ENABLE_URP 조건부 코드가 있으므로 증상이 미묘합니다.

수정 방법:

  1. 패키지 관리자에서 com.unity.2d.pixel-perfect 제거
  2. 각 카메라에서 UnityEngine.U2D.PixelPerfectCamera 제거
  3. UnityEngine.Rendering.Universal.PixelPerfectCamera 추가
  4. 재구성 — 불리언(pixelSnapping, upscaleRT, cropFrameX/Y)이 열거형(gridSnapping, cropFrame)으로 변경됨

→ 감지 코드: references/pipeline-detection.cs (파일 하단).

이전 URP 네임스페이스 (Unity 2022 이전 / URP 13.x 이전)

증상: UnityEngine.Experimental.Rendering.Universal을 참조하는 컴파일러 오류.

수정 방법: using UnityEngine.Experimental.Rendering.Universal;를 using UnityEngine.Rendering.Universal;로 바꾸세요. 어셈블리 한정 타입 문자열을 업데이트하세요. [MovedFrom] 속성이 직렬화를 자동으로 처리합니다 — 게임 오브젝트의 컴포넌트는 업그레이드 후에도 유지됩니다.


일반적인 문제 및 해결 방법

흐릿한 스프라이트

수정 방법: 모든 대상 스프라이트의 필터 모드를 Point로 설정하고, 밉맵을 비활성화하고, 품질 설정에서 AA를 비활성화하세요. → 코드: references/sprite-settings.cs

타일맵 타일 사이의 간격

순서대로 진행하세요 — 음수 셀 간격이나 PPU = 31.99와 같은 해결 방법은 카메라가 움직일 때 깨집니다.

#확인 사항수정 방법
1스프라이트 아틀라스에서 타이트 패킹이 꺼져 있고, 패딩 ≥ 4이며, 스프라이트 패커 모드가 활성화되어 있습니까?에디터 설정에서 스프라이트 패커 모드 활성화; 아틀라스에서 패딩 ≥ 4로 설정하고 타이트 패킹 끄기
2타일셋 텍스처와 아틀라스에서 밉맵이 비활성화되었습니까?Generate Mip Maps 비활성화
3AA = 0, 카메라에서 MSAA 꺼져 있습니까?AA를 전역적으로 비활성화
4압축 = None입니까?RGBA 32비트 압축 없음
5모든 타일 스프라이트의 픽셀 크기가 짝수입니까?홀수 크기는 0.5px 그리드 오프셋을 발생시킵니다
6PPU = 타일 픽셀 너비입니까? (16×16 → PPU 16)PPU 불일치는 물리적 간격을 남깁니다
7위의 모든 검사 통과 후 카메라 이동 중에만 간격이 발생합니까?PP Camera 픽셀 스냅 사용; cellGap = -0.01f 사용하지 않음

Cinemachine 충돌

원인: Cinemachine과 Pixel Perfect Camera가 매 프레임마다 직교 크기에 기록합니다.

수정 방법: 각 가상 카메라의 확장 추가 드롭다운을 통해 CinemachinePixelPerfect 확장을 추가하세요. 코드에서 AddComponent로 추가하지 마세요.

알려진 제한사항:

  • 가상 카메라 간 카메라 블렌드는 전환 중 픽셀 완벽하지 않습니다
  • UpscaleRenderTexture는 유효한 픽셀 완벽 직교 크기를 줄여 프레이밍이 어긋날 수 있습니다
  • Target Group + Framing Transposer는 눈에 띄는 끊김 현상을 유발합니다 (수정 방법 없음)

upscaleRT 사용 시 포스트 프로세싱 블러

원인: 포스트 프로세싱이 PP Camera가 렌더 텍스처를 업스케일한 후에 실행됩니다.

간단한 수정: upscaleRT를 비활성화하세요. 그러면 포스트 프로세싱이 기본 화면 해상도에서 실행됩니다.

고급 수정 (Unity 6 URP): RenderPassEvent2D.AfterRenderingPostProcessing에서 ScriptableRendererFeature2D를 삽입하세요. 2D 전용 기본 클래스 사용 — ScriptableRendererFeature(3D 기본 클래스)는 URP 2D 렌더러에서 자동으로 무시됩니다.

upscaleRT 사용 시 UI 텍스트 흐릿함

상태: 알려진 U

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

unity-technologies/audio-setup-mixers

Scans the scene and audio assets to appropriately route Audio Sources into existing Audio Mixer Groups, classifying each source by what it plays. Use when the user asks about cleaning up mixer assignments, routing audio through a mixer, or which group a sound belongs in. Creating mixers and groups, and setting volumes, are not automated — the skill inventories what exists and asks the user to add anything missing.

unity-technologies/build-live-game

Build and operate a live game using Unity Services. Use when the user needs to implement, connect, or debug backend-driven features — battle passes, achievements, player progression, cloud saves, leaderboards, matchmaking, virtual economies, server-authoritative logic, anti-cheat, player accounts and authentication, remote configuration, feature flags, A/B testing, analytics, or cloud resource deployment. Triggers on live-ops, live service, backend, server authority, cloud code, cloud save, remote config, player data, retention, monetization loop, season pass, ranking, multiplayer sessions, lobbies, or any Unity Services integration.

unity-technologies/generate-editor-search-query

Generates Unity Search / Quick Search queries and opens the Unity Search window for read-only Unity Editor asset or scene-object lookup requests. Always use when the user asks to find, search, show, locate, filter, look up, query, or list concrete assets or scene objects in the current project or scene, even if Unity Search is not named. Covers materials, textures, prefabs, scenes, scripts, shaders, GameObjects, components, Lights, Cameras, UI objects, labels, paths, references, selected or named assets, and asset types. Also use when the user explicitly mentions Unity Search, Quick Search, Search window, open Search, or asks what Unity Search query to use. Do not use for general project overview, project structure, folder-purpose summaries, gameplay/system explanations, how-to programming questions, web search, repository text search, build logs, package installation, menu or settings search, modifying results, or non-Unity filesystem search unless the user explicitly asks to use Unity Search.

unity-technologies/implement-in-app-purchases

Implement, configure, and debug Unity In-App Purchases (IAP) — store connection, product catalog, consumable/non-consumable/subscription purchases, two-step pending-confirm flow, receipt validation, entitlement checking, restore transactions, Apple extensions (promotional purchases, Ask-to-Buy, code redemption), and Google Play extensions (subscription upgrade/downgrade), D2C Capabilities(direct to customer), 3rd party payment provider (Stripe/Coda) via Unity IAP/Unity Cloud. Use when the user needs to add, modify, debug, or migrate from native Android/iOS billing, 3rd party packages(RevenueCat/Adapty/Essential Kit/Unipay supported) to IAP. Triggers on microtransactions (MTX), monetization, real-money purchases, store purchases, buying items, support D2C, purchase via Stripe/Coda, migrate from native billing(Google's BillingClient or Apple's StoreKit/SKPaymentQueue/SKProduct)/RevenueCat/Adapty/EssentialKit/Unipay.

unity-technologies/initialize-ai-navigation

Sets up and configures the Unity AI Navigation system — NavMesh surfaces, NavMesh agents, obstacles, links, modifiers, areas and costs. Use when creating walkable navigation meshes, adding pathfinding agents, setting up patrol routes, configuring obstacle avoidance and carving, connecting separate NavMeshes with links, coupling navigation with animation, or troubleshooting navigation issues.

unity-technologies/levelplay-unity-integration

Integrates the LevelPlay Mediation SDK via the Ads Mediation UPM package. Use when a developer asks about adding ads to a Unity game, implementing rewarded, interstitial, or banner ads, setting up ad mediation, configuring ad networks, installing or updating the Ads Mediation package, troubleshooting LevelPlay namespace errors, resolving Android gradle or iOS CocoaPods dependency issues for ads, configuring ATT or privacy settings for ad compliance, tracking impression-level revenue (ILRD), initializing the LevelPlay SDK, or setting up ad unit IDs. Also use when a developer wants to monetize their Unity game with ads, asks how to get started with LevelPlay, ads, or mediation, or needs help with any part of the LevelPlay integration workflow including platform-specific setup for iOS or Android. Also use when upgrading the LevelPlay or IronSource SDK version, migrating from deprecated IronSource.Agent APIs, or migrating a game from Unity Ads to LevelPlay.

unity-technologies/localization

Sets up and configures Unity Localization, including locales, String/Asset Tables, CJK font support, and Addressables workflows. Use when the user wants to add languages to a project, translate UI text, support Asian (CJK) languages with TMP fonts, or mentions i18n, l10n, multilingual support, or making a game support multiple languages.

unity-technologies/manage-sprite-atlas

Manage SpriteAtlas using prebuild pipeline with IPreprocessBuildWithReport (DEFAULT approach). Use it to configure master atlases, variant atlases, texture settings, packing settings, and platform-specific configurations. Use when the user asks about creating sprite atlases, optimizing sprites, configuring atlas settings, adding sprites to atlases, creating variant atlases, implementing automated atlas generation, or runtime sprite atlas access. Always use prebuild approach unless user explicitly requests manual authoring.

unity-technologies/migrate-birp-to-urp

Plans, executes, and troubleshoots Unity projects moving from the Built-in Render Pipeline (BiRP/BIRP/Built-in RP) to the Universal Render Pipeline (URP). Use when the user asks to upgrade, convert, switch, or migrate a project, scene, material, or shader to URP/Universal Render Pipeline; fix pink or magenta materials after URP; convert Built-in materials/shaders; move a 2D project to URP 2D; review lighting, quality, post-processing, baked lightmaps, or reflection probes after URP; or diagnose visual problems after a render-pipeline migration.

관련 스킬