This one is simply confusing. I have an image with the dimensions of 480 x 73.
When I call
(texUI : Texture) var sizeX : float = texUI.width; var sizeY : float = texUI.height; it returns 512 x 64. ??
The inspector import settings for the texture are (and I should mention I don’t have much idea what any of this does!) :
Texture Type : Texture
Alpha from Grayscale : Unchecked
Wrap Mode : Clamp
Filter Mode : Bilinear
Aniso Level : 1
Max Size : 512
Format : Truecolor
You didn’t say what the most important setting is in this case, namely “non power of two”. Which is the answer.
If anyone else stumbles upon this in the future the issue is, as eric tried to point out 9 years ago, that texture.width/height returns the width/height of the texture after unity converts it to a power of 2. So if you’re working with the pixel values of the texture it won’t return the values your expecting. If you’re still looking for an answer to this might I direct you towards https://forum.unity.com/threads/getting-original-size-of-texture-asset-in-pixels.165295/