Pixels to units question

I have a background image for 2D adventure game which is 1024 x 307 in pixels.
Pixels to units ratio is set to 100, meaning this image should be about 10 units x 3 units.
But, somehow it becomes approximately 60 units wide and 25 units in height. How come ?

I get warning in the inspector on image size not beeing multiple by 4 so it cant be compressed in DXT format, could this be the problem ?

I want to be able to get image width in units, smth like widthInUnits = image.width / ratio (ration beeing 100 in this case), so i get 1024/100 = 10 Units, but in action my image turns out to be 60 units in width… i dont understand how this happnes, which ratio is used ?

I use ortographic camera.


I realized that my image is in fact 6668x2004,
and that is what actually gets translated into units, 66 x 20 units, but when i import image into unity it asks me for the “max size” in import settings, that was set to 1024 so when i obtain image.width its 1024. I tryed changing maximum size to 4096 in import settings (which is max sizei can get), but still image.width returns 1024.

I dont understand how Unity actually uses 6668x2004 image dispite max size is set to 1024. And even if max size is set to 4096, image.width still returns 1024…


Ok it returns 4096 i was referencing wrong image in code sry

Now the question remains, why does unity use 6668x2004 image in spite of setting 4096 to be max allowed. Should i simply resize my original image to be 4096xSomthing, and never use larger images?

Unity is most likely resizing your picture to a power of 2. 307 is an odd number so it’s scaling it up pretty big, hence why your unity units is higher than you expected. If your image fits, put in a 1024 * 256 file, otherwise, use 1024 * 512.