Making UI Image Sizes same as Sprite Renderer Size

i’m avoiding mixels in my game by comparing the sizes of all the sprites in my pixel art software (aseprite), then not changing the size of anything when i put it into unity, and I set the pixels per unit to be 16. This is been working perfectly for things with sprite renderers in my regular scene and everything’s been the exact size I want it to be and the pixels sizes are all perfect.

however, when I put a sprite into my UI Canvas and Set Native Size, the size will be different than if i were to insert the same sprite into the scene with a sprite renderer instead of an image component, and transform instead of rect transform.

I have been using unity for a while now but am fairly new to UI design.

Below is the difference between them while in the game window, the smaller one is the Native Size in the UI, and the bigger one is the default size as a sprite renderer in my scene

as well as my canvas settings

How could I have them be the same size by default?

The UI (Canvas) and the world are two different perspectives.
The UI (Canvas) uses the screen dimensions.
On the UI Canvas

  • check the Canvas Scaler and figure out how you want your game to scale on different screens and different screen-aspect-ratio’s
  • (I often keep either the height fixed or the width fixed, depending on my game)

Next, you can use the camera.main to calculate world space points vs screen space points.
Depending on the main camera size, you can calculate how big the actual image should be on your UICanvas. For the details of that algorithm, ask ChatGPT…

Hope it helps,