images imported to be used for GUI are bigger and pixalated

Hello Guys,

I am trying to import an image (sprite atlas) after making it in Texture Packer and then importing it, this causes the image to be pixalated a bit and all the individual images are slightly bigger.

when i try to import the individual image on their own directly, they are no longer pixalated, but they are still a bit bigger, for example one of the images is 960 x 200, and i have set resolution of my game to be 960 x 1280 but still the imported image doesnt fit into when placed as UI → Image and is bigger.

Can anyone tell me why both things are happening?

Thanks

Click a sprite to have it’s import settings open in the inspector.

The pixelation and loss of quality is probably an unfortunate result of the way your image is saved, imported into unity, and THEN compressed by unity. Try changing your compression format or your max size.

Under your sprite mode, “Pixels per unit” decides how many sprite pixels fit into 1 world-space unity unit. The default is 100, which means a 100x100 image will fit inside a 1x1x1 world-space unit.

I’m not really sure if this solves your problems, but it’s worth a shot. Best of luck!

thanks for replying,
i tried the pixels per unit, but no matter what value i set for it, the image size on screen doesnt change

I’m probably not understanding what the problem is.

You can resize UI.Images using their RectTransform width and height (in-editor or in-code). You should also check your canvas scaler component attached to your canvas. If it’s set to “constant pixel size”, your canvas will resize based on your screen size and will either cut off pixels or add pixels, making it appear as though your UI has moved or resized in a build. If your canvas scaler is set to “scale with screen size”, your canvas will scale itself to fit the aspect ratio you give it, then it will shrink/expand to fit your screen.

I highly recommend “scale with screen size” if you aren’t already using it.