Quick answer: Set Reference Resolution to your design canvas (320×180 typical pixel art). Crop Frame = Window. Stretch Fill = off for true pixel-perfect with bars; on for full-screen with stretch.
Pixel art game with 320×180 design renders pillarboxed in a 16:9 window when you wanted nothing. Or vice versa. The Crop Frame setting picks behavior.
The Symptom
Game shows unexpected black bars or stretching. Editor and build behave the same way; you don’t want either.
The Fix
Pixel Perfect Camera component:
Asset Pixels Per Unit: 16
Reference Resolution: 320 × 180
Crop Frame: Window // or Pillarbox / Letterbox / None
Stretch Fill: false // off = bars, on = stretch
Pixel Snapping: true
Upscale Render Texture: true // crisp pixel edges
Crop Frame Modes
- None: scale to nearest integer; may stretch.
- Pillarbox: vertical bars when window is wider than reference aspect.
- Letterbox: horizontal bars when window is taller.
- Window: pick based on which axis exceeds reference.
Window is the most flexible default for arbitrary windows. Pillarbox/Letterbox lock the bar orientation if your game has a known aspect.
Stretch Fill Trade-Off
Stretch Fill on: full screen but pixel edges may be slightly distorted at non-integer scales. Off: pixel-perfect but you accept bars on mismatched windows.
Verifying
Resize the Game window to 1920×1080, 1366×768, 1280×720. Bars should appear or not appear consistent with your Crop Frame choice. Pixels stay sharp with Upscale Render Texture on.
“Pick Crop Frame. Stretch or bars. Pixel art holds its grid.”
Related Issues
For Canvas Scaler high DPI, see Canvas blur. For TilemapRenderer batching, see Tilemap batching.
Reference resolution. Crop Frame. Pixels stay perfect.