Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started 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.
-
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).
-
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 :
- Switch to the Standalone platform,
- In asset folder, select the image file,
- Set the type to "Advanced",
- Set Non power of 2 to "none",
- Set wrap mode to "Clamp"
After that, you can switch to different platform, the sprite size keep the same.