Pixel perfect camera isn't working

I’m using 16:9 aspect, and all my sprites are 32 pixels per unit.
My camera stats are these:


When doing “run in editor” it looks worse than with out it, and also in play mode it’s bad.
It says the message “Rendering at an odd-numbered resolution (853 * 480). Pixel perfect camera may not work properly in this situation”
How to fix this?

Wow, that must be the tenth or so question regarding pixel perfect cameras in the past ten days. :slight_smile:

To the question: is there a reason why the camera is perspective rather than orthographic?

I also notice that the PixelPerfectCamera component is outdated from the one I use. Either that’s an older package or the new settings are only available in Unity 6.

Pixels Per Unit - for all intents and purposes - should be left at 100 and likewise for the sprites. The PPU is NOT the size of the images. Or not necessarily so, it is certainly not required to set this to match your sprite’s sizes.

If the PPU together with the camera results in weird zoom in/out behaviour you should alter this. Effectively, the PPU only tells which size the sprites will be rendered at but you can achieve the same by adjusting the zoom (orthographic size) of the camera instead.

Also, the PPU makes some coordinate calculations easier to grasp but not necessarily easier to calculate. 32 PPU with 32x32 sprites means effectively each sprite occupies 1 unit in every dimension. But this may still be at odds with the coordinate system if the sprite pivots are centered, then the sprite transform position would be something like {38.5, 76.5}.

So be sure to first check if you get any zoom in/out issues before proceeding. Or ignore, if you know you’ll never do any kind of zoom or use your own tile coordinate system anyway.

That’s just a true statement. You can’t upscale integer values (read: pixel perfect coordinates) to an odd number ie there is no way to multiply 2 with another integer number to get to the value of 3 or 5 for instance.

Why are you rendering at that odd resolution? I suppose your game view isn’t set to a specific size but rather left at “free aspect” thus the resolution depends on the size of the game view window. Try setting game view to a fixed resolution like 1920x1080 or at least a fixed aspect of 16:9.