- Home /
Why is my sprite not pixel perfect?
I have created a pixel perfect background using this method: http://answers.unity3d.com/questions/9729/how-can-i-display-a-flat-background-2d-image-not-a.html
The background texture 512x512 and when I log mouse clicks the size is 1-to-1 with the screen pixels ( mouse-click on the left edge is 0 and on the right edge is 512)
I have a rectangle sprite that is on a 512x512 sprite atlas. In photoshop the sprite is 135 pixels wide.
I import the atlas (pixels to units = 1) as a sprite and when I slice it using the new 4.3 slicer it shows the sprite as being 135 pixels width.
When I display the sprite on my background and click on the right edge it is 150 pixels wide.
Why is it stretching the extra 15 pixels?
The sprite scale is 1,1,0
The background is a map and I need to position the sprite in an exact location.
I believe it has something to do with the orthographicSize property of the camera. I'm dealing with the same thing now.
You are correct. $$anonymous$$y background camera has a size of 256... half of the guitexture height.
I set the main camera to the same size. When I change it to a size of 300 the sprite is correctly sized.
While it fixed the display I wish I knew what was happening.