Is it possible to achieve a pixel perfect UI? Heavily trying to no success.

I have choosed pixel art for my current 2D game.

The trouble is that i can’t predict the results of how a texture looks in different screen resolutions. (UI Image)

I have a “rounded button” texture with 1px outline border. Depending on resolution the border goes wild; having more than 1px width, one side not displaying border at all…

I have tried:

  • Different texture resolutions, always power of 2. (64, 128, 256 and 512)
  • Pixel snap checkbox from default sprites shader. (Which works with some resolutions but not in others)
  • Canvas pixel perfect checkbox.
  • Texture filter point, bilinear filtering sometimes fixes the result but breaks the “clear or crispy” pixel art.
  • Different canvas scaling methods, 0.5 between width and height, shrink and expand.
  • Different PPU. (1, 100…)
  • Atlased texture, non atlased, 9 - sliced.
  • Different border widths. (1px - 4px)
  • Preserve aspect from UI Image element checkbox.

Everything i do takes me to the same point. My “rounded button” texture will have unpredictable results depending on resolution.

What is causing this pixel imprecision?

I can further extend this post saying that sprite renderer pixel imprecision can be corrected adjusting the camera Ortographic Size based on screen resolution.

What i need is a technique that does the same but that works for the UI.