Alright, so this is my first post on the Unity forums. So excuse my ignorance of any unwritten rules.
I have built an automatic sprite atlas generator, that searches my project for specific scripts and constructs an atlas from them. This all works fairly well, I have even been able to make use of this for my 3D game objects, by setting the UVs accordingly.
However, I am running into a bit of an issue. Its not major but I am trying to clean up my tool for quicker use. Essentially, I use PackTextures to build the texture, convert it to ARGB32 and then into my desired format (be it DXT or PVRTC etc). This however, seems only to work correctly when my build settings are set to PC Standalone, not Android or iOS.
The UVs seem to be remapping correctly regardless of platform. It seems to be the generated texture that is causing the issue. As shown below:
(As seen on PC)
(As seen on Android)
Any help, would be greatly appreciated. Thanks in advance!
This looks like a bug that will live forever in Unity 3.x. I've seen it happen with every UI plug-in I've tried that relies on Unity's texture packer.
It seems to happen when your textures' combined width or height is exactly or over the atlas limit you are targeting, but apparently only on mobile build targets. Although I've not seen your exact example have it happen... personally I've only seen this when one of the textures is actually equal or larger than the full extent of the final atlas. For example, if I'm trying to make a 2048x2048 atlas and my largest texture is actually 2048 high or wide, this error happens, even if it is the only texture I'm trying to put in the atlas.
I think there must be some kind of padding math error on this codepath in Unity.
I've found a slightly ugly workaround, if you reduce your offending texture by a couple of pixels to be less than the final atlas boundary, it no longer happens.
Not sure if this will help you or not, but thought I'd share.
answered May 21 at 06:37 PM