I'm new to Unity and trying to make a 2D game for iPhone. I'm using Sprite Manager 2 and have the camera set to orthographic with an orthographic size of 160 (for 480x320 landscape resolution).
I have a sprite that is 480x68 in size. I have applied the standard Sprite script from SM2 to the game object. When I play test the game, the camera looks right and the sprite looks correctly positioned, but the texture is slightly wrong. It has cut off a bit from the right side of the texture and stretched it. It also appears to be tiling slightly on the Y axis.
Screenshot of what the sprite looks like along with the settings I configured:
Here is what the image should look like:
How do I get the texture to appear correctly?
EDIT: Just noticed that you can't make out the settings, here they are: Width: 480 Height: 68 Lower Left Pixel: X: 0 Y: 67 Pixel Dimensions: X: 480 Y: 68
asked Dec 06 '10 at 03:12 AM
Yes, the texture is being wrapped around if it's too small for the size of the sprite. The problem is trying to find the right, exact size (pixel dimensions) for the texture to fit the sprite. After doing many sprites now, there seems to be no method for figuring this out apart from guessing. Basically I make the pixel dimensions the same size as width and height initially, then run in game and keep changing pixel dimensions until the texture fits properly. It seems to be completely random as to how much you need to change it (doesn't correlate to image size of your texture at all).
One thing I did notice is that most of the time, the lower left pixel Y should be the same as pixel dimensions Y. Changing the lower left pixel X and Y offsets the texture by the respective axis.
answered Dec 09 '10 at 02:46 AM
It appears that the top of your sprite is being wrapped-around to the bottom of your image. This could be a UV problem (where the UV's of your object are out of alignment) or a case where the sprite is not being aligned like you think is should. I don't know much about Sprite Manager 2, but perhaps the texture has been compressed? A power-of-2 texture size height might give you better results (but, then again, 58 isn't a power of two...)
answered Dec 06 '10 at 05:51 AM