Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: yuriks on September 26, 2013, 03:23:32 PM
-
(I'm using NGUI 3.0.0e and Unity 3.5.7f6.)
If I elect to use the internal sprite packer instead of Unity's one, I frequently get these two errors in the log when trying to update an existing atlas with new sprites:
Error: Unsupported image format - the texture needs to be ARGB32 or RGB24
UnityEngine.Texture2D:EncodeToPNG()
UIAtlasMaker:UpdateTexture(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:485)
UIAtlasMaker:UpdateAtlas(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:574)
UIAtlasMaker:AddOrUpdate(UIAtlas, Texture2D) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:531)
UIFontMaker:OnGUI() (at Assets/NGUI/Scripts/Editor/UIFontMaker.cs:275)
UnityEditor.DockArea:OnGUI()
Error: NullReferenceException: Object reference not set to an instance of an object
System.IO.File.WriteAllBytes (System.String path, System.Byte[] bytes)
UIAtlasMaker.UpdateTexture (.UIAtlas atlas, System.Collections.Generic.List`1 sprites) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:486)
UIAtlasMaker.UpdateAtlas (.UIAtlas atlas, System.Collections.Generic.List`1 sprites) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:574)
UIAtlasMaker.AddOrUpdate (.UIAtlas atlas, UnityEngine.Texture2D tex) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:531)
UIFontMaker.OnGUI () (at Assets/NGUI/Scripts/Editor/UIFontMaker.cs:275)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
The atlas image then gets replaced with an empty asset. I'm not modifying the atlas texture import options, they're at the NGUI defaults. If I delete the texture and generate it again it works fine.
-
Curious. Replace line 480 in the UIAtlasMaker -- it uses RGBA32. Change it to ARGB32.
-
On my copy of the file 480 is a closing brace. Line 474 is:
tex
= new Texture2D
(1,
1, TextureFormat
.ARGB32,
false);
That is, it's already ARGB. Didn't find any references to RGBA32 on the file.
This is how the import settings look like on the failed file:
(http://i.imgur.com/Tzh4T2P.png)
-
Sorry I meant NGUIEditorTools.cs.
-
Changed, same results.
-
Find the other RGBA32 in that file and change it as well.
-
That one seems to have fixed it, I can update the atlases without any issues now. Cheers for the quick responses!