I'm working with Unity 4.3 and NGUI v3.0.3f3, on a GUI-centric social game for iOS, and am suddenly running into a lot of issues with Atlases and Sprites. I'm putting these issues in one thread because I'm not sure if they're related.
Atlas Generation:First, I'm getting an issue where Atlas Maker isn't generating the Atlases properly. I select the sprites (about 45 of them), give it a name and hit "Create". It seems to run, and generates the GameObject, Material and the atlas image file (1024x512). However, when viewing the object in the Atlas Maker its not showing any of the sprites in the list. If I press the available "View Sprites" button, it opens an empty "Select a Sprite" window.
Now, if I reselect the desired sprites, they'll show up again in the Atlas Maker with the green "Add" text lit up. Hitting "Replace" starts to process; however, the "Updating" dialog hangs (at 100% with the text "Updating the atlas, please wait..."), and I have to manually kill Unity (though the OSX 'Force Quit Applications' doesn't show Unity as unresponsive, I can't really do anything or access any of the menus). The console shows an error, which I've included an image of as "Replace_Atlas_Error.png" (sorry for the image, I would have Copy/Pasted, but Unity wouldn't let me copy it at that point)
I am able to create the Atlas if I include less sprites at a time (I think it crapped out around ~20 for the initial atlas creation).
Sprite ArtifactsMoving on, lets say I create some Atlases with just a few images. When they are generated, for some reason Unity is automatically applying "Override for iPhone" on the atlas image settings, with the Format set to "16 bits". That of course looks horrible (
http://www.tasharen.com/forum/index.php?topic=1497.0). However, if I change the Format to Truecolor or disable the iPhone override, the resulting sprites all have really horribly image artifacts on them.
I've attached an image (Texture_Sprite_Atlas_Compare.png) showing the crisp looking graphic rendered with a UITexture, what it looks like when the Atlas is first generated (set to 16bits), and what it looks like when I set it back to Truecolor.
A few more interesting things I just noticed that may be of help:
- The Unity Inspector's image preview of the .png shows the same artifacts, even though the .png itself doesn't have any artifacts.
- The Unity Inspector's image preview of the UISprite shows a proper looking image
Texture -> Sprite Automatically being replacedDoing these tests led me to find another issue. During the test I had the UITexture object that displayed the reference "2" image. When I generated an Atlas that included the 2, the UITexture was automatically replaced with a UISprite (not what I was wanting, but I could see that being a feature). Problem is, the Sprite didn't actually show up, despite the Atlas and Sprite objects being set in the inspector. I've attached another image, in case it helps (Texture_To_Sprite_Autoreplace.png)
Sorry for the lengthy post, but if anyone has any suggestions I'd really appreciate it!