Hello there!
If you’re using Unity 3D to develop a game, you might know about the Next-Gen User Interface plugin by Tasharen Entertainment, also know as ArenMook in the Support Forums.
I have been working a lot with it, because Unity‘s built-in GUI system was terrible, until Unity 4.6 when they introduced a revamped version of uGUI , which is good and very close to NGUI‘s system.
Games I have worked on were released on PC, Android and iOS. Everything was working perfectly on all devices (I thought).
Recently, I’ve discovered something quite interesting; a very disturbing bug which can make you loose a lot of time (which I have lost, yes).
Here’s the thing.
All of my user interface displayed perfectly on iOS, PC and most Android devices. However, on low-end devices, here’s how it surprisingly displayed:
All the sprites and Bitmap fonts were displayed as ugly rectangles! The black rectangles are supposed to be letters generated by Bitmap fonts using Alpha. The other rectangles are supposed to be sprites, which have transparency, and aren’t at all supposed to be square.
Basically, on most Android devices, default configuration of NGUI atlases (using compression or not) will run smoothly without visual artifacts, or only minor ones if any.
After thinking that the Alpha channel in the Atlas was the issue, since ETC1 compression does not support an Alpha channel, I discovered that the issue was simply due to the Atlas texture’s size.
Indeed. My Atlas texture size was 4096×4096. Low-end devices like the Samsung Galaxy Trend equipped with a Adreno 200 and Snapdragon S1, not only can solely support ETC1 compression, but the maximum texture size is limited to 2048×2048.
In other words, if you want your game’s user interface to display correctly on absolutely all Android devices, you need to set your NGUI Atlas’ max size to 2048×2048:
That’s it.
If you use texture compression, I recommend you set the Texture Compression override to ETC1 in the Build Settings:
This ensures your game’s compressed textures will remain compatible with all Android devices on the market, and you won’t have any undesired surprises.
Also, remember to set the NGUI Atlas’s texture compression format to TrueColor:
Indeed, compression is good for 3D models only – avoid it for User Interface elements. Any texture with TrueColor format will be left alone and won’t be compressed to ETC1.
I hope this will help you prevent this unusal bug!
Cheers,
Aze
PS: Thanks Dezachu for pointing out this Atlas size limit hint 😉
0 Comments