So, I’m having a problem on the pixel perfect side of things for sprites, both normal and UI. The fact is that I’m using a fixed scale to have all sprites have the same scale on different resolution, using the Canvas Scaler for UI and doing the same calculation for the orthographic camera.
Now tthe problem only occur on certain resolutions, for some weird reason is all fine on 1920x1080, but my fixed resolution is on 320x240 so sit should scale better on 1024x768 but isn’t the case.
Here a screenshot to show the issue:
I f you look closer both fonts and certain sprite elements are not scaled correctly. Can be seen especially on the health bar, each fragment is of different effective pixel sizes.
For the font I use a non dynamic font, that I import at runtime reading from external files, is a pixel perfect font that is never scaled and all the components are set t obe a fontSize of 16. If I zoom in the scene editor window all sprites and fonts are fine, is just the rescaling of resolution that mess things up.
I tried many approaches to avoid that, messing with Match width and height on the canvas scaler, trying to recalculate half pixel offset and all that, but to no result. The Canvas Scaler is set to fixed scale of 320x240 iwth a pixel to unit reference of 32. The same goes for orthographic camera, I do this simple operation to calculate the size:
fixedResolution.height / pixelsToUnit / 2; beign in my case 240/32/2.
What kind of approach should I use to fix the jagged pixels on the sprites?
