I’m seeing a lot of old threads on similar issues, without a lot of answers. So I’ll do my best to lay this out clearly.
The basic setup I’ve got:
pixel perfect camera
- PPU: 16
- Reference Res: 568 x 320
- crop frame: letterbox
- grid snapping: none
CinemachineCamera
- Ortho size: 5 (but I have several cameras and will probably change this in various places)
- Position Composer (follows player w/ target offset set to a direction the mouse is relative to the player)
- Impulse LIstener
- Cinemachine Pixel Perfect
- Confiner 2D
Canvas
- pixel perfect checked
- Canvas Scaler
– pretty sure I want scale with screen size, with resolution matching my pp-camera?
– reference ppu doesn’t seem to do anything?? (my sprites are coming from asepriteImporter)
The main issue
No matter how i set it up, there’s some issue with the Canvas
- If I use “Screen Space - Camera”: my UI is super jittery whenever the camera moves, regardless of “pixel perfect” setting in canvas.
– Turning off pixel perfect camera fixes this, but I need this component to render my game correctly. - If I use “Screen Space - Overlay”: my UI isn’t constrained to the pixel perfect camera’s letterbox, and any part that ends up in the letterbox doesn’t clear between draws (eg, if the ui moved, it would leave a smear of the old frames)
What setups do people use for UI canvases when utilizing pixel perfect camera & cinemachine??
One thread i saw linked to a unity project with a “customCanvasShader”, but it seems to solve an issue that might not be an issue any longer? I say that because it’s built to be used with the pre-URP pixel perfect camera and the canvas set to “screen space - camera” and still suffers from the aforementioned jitters.