Author Topic: Using UISpriteAnimation with a scaled sprite  (Read 4093 times)

db82

  • Guest
Using UISpriteAnimation with a scaled sprite
« on: August 01, 2012, 06:19:45 AM »
Just thought I'd dump my email conversation with the very helpful NGUI creators in case anyone else run into this problem:

ME:

I'm using UISpriteAnimation on a sprite that I've scaled in the Unity editor.

Problem is, when I run the game the scale resets to pixel perfect. I can comment out mSprite.MakePixelPerfect() in the Update function (of UISpriteAnimation) but the scale becomes distorted.


Phil:

The make pixelperfect is there for a reason and that reason is that each sprite could be a different size. Think about a running animation as the sprites animate the width of the sprite would need to get larger and smaller (to save space) as his legs get closer and further apart.

One thing you can try is when you create you atlas DON'T "Trim Alpha" This will keep you sprite the size that you made them and assuming they were all the same size (width, height) to start. Removing the pixelperfect now should not be a issue although you will likely see some distortion as the due it not being pixel perfect.


Michael:

Scale the parent game object if you must, not the sprite itself, but make sure the scale is uniform (all 3 values match).

I don't recommend scaling anything, however. You lose pixel-perfection, resulting in blurriness.