Has anyone made a successful Pixel Perfect Camera script for platformer games?

I’ve tried giving the asset store a try since I’ve been trying to figure out the logic myself, and the assets I tried all have not gotten this to work. I emailed the creators and they’ve been kind enough to email back with suggestions, yet my camera shakes when their scripts try to adjust the sprites to the screen resolution.

I have seen this blog mentioning how to do it manually, yet I’m making a mobile game, and the resolutions will change from device to device. Another issue is my camera is not static and moves so the sprites might not line up with the screen pixels as they should.

Any idea on how to get this to work? I’ve been wondering if anyone has gotten this to work and really wish this was a default feature in Unity.


Sample Project Folder in .zip file format if needed/wanted: https://www.dropbox.com/s/rp93y2yrj6f4tiz/SampleGame.zip?dl=0


Also the CameraScript.js Update function was supposed to be changed to LateUpdate to fix some camera shaking.

the default sprite renderer is capable of pixel snapping, so even if the camera sits at ,5 on any axis, the sprite will render correctly.

the camera orthographic size is half the screen height in Unity units. with sprites rendered with 100 pixels a Unit and let’s say a screen resolution of 1024 * 768 results in an orthographic size of 3,84 (Screen.Height / 100 / 2). Let’s call it design size you create your game for. for every device with a higher res, this will of course give a larger orthographic size, shrinking the content. The opposite is the case for lower res devices.