Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: MatthieuG on April 17, 2014, 09:12:49 AM

Title: Why NGUI trim alpha on UI2Sprite ?
Post by: MatthieuG on April 17, 2014, 09:12:49 AM
Hi !

Why when I use a sprite with UI2dSprite the size of the texture is different from the size in asset folder ?
Here the preview in the asset, the size is 96x96 :
http://picpaste.com/pics/asset_sprite-kHiPQe4A.1397742166.PNG (http://picpaste.com/pics/asset_sprite-kHiPQe4A.1397742166.PNG)
Here the preview in UI2DSprite, the size is 60x82 :
http://picpaste.com/pics/ui2dsprite-e7nwrnUd.1397742198.PNG (http://picpaste.com/pics/ui2dsprite-e7nwrnUd.1397742198.PNG)

Can I disable this behaviour ?
The problem is when I switch the platform (Standalone to Android), the picture is no more trimmed but UI2DSprite dimensions keep the same, so the picture looks bad.

I'm using NGUI 3.5.6, 2d UIroot with pixel perfect.

Thank for your help.
Title: Re: Why NGUI trim alpha on UI2Sprite ?
Post by: ArenMook on April 17, 2014, 01:10:20 PM
That's done by Unity, and is part of why 2D sprites can't be used by NGUI properly if they've been atlased by Unity. Don't use this functionality until Unity 4.5+ (which is when the missing functionality will be added in Unity).
Title: Re: Why NGUI trim alpha on UI2Sprite ?
Post by: MatthieuG on April 30, 2014, 07:40:39 AM
Thank you for the details.

Unfortunely, I have to use Unity 2D Sprite, BUT I finally found a solution to force Unity to don't trim alpha :
After that, you can switch to different platform, the sprite size keep the same.