No alpha for .png textures after upgrade to 5.5.2p2

I am trying to upgrade our project to Unity 5.5.2p2 (was: 5.3.6p8)

Many textures appear to be broken as their import settings are incorrect. these textures do not show with a transparent background for some reason (most probably because of the import settings).

I am not sure if this is a known bug (i recall seeing something like that), and how to fix it.

Note that this is not just a single texture or a couple of them - we are talking about many textures that i have to pinpoint and fix right now.

It seems Unity has trouble with PNG-8 files.

I expeirence same issue:

Is there any fix for this ?

Only solution I know to open in file in an image editor and re-save it as PNG. But I hope Unity fill fix this ASAP.

@amjaliks did you report this as a bug by any chance ?

@liortal , yes, I did. Case 892300.

I got replay from QA recently:

Hi. We are working on getting this fix into a patch for both 5.5 and 5.6.

1 Like

do you know when this patch should land? also can you confirm that 5.5.1 does not suffer from this issue ?

Ok looks like I spoke too soon. I was under the impression that it has been fixed but its still active. I have grabbed the bug so I’ll take a look into it today and let you know when I have more information.

Thanks. it would be great to know if we can apply any workaround instead of waiting for a patch.

For example - can i create an editor script that will automatically patch texture importer settings somehow? i am not sure which textures i should select using this script?

@karl_jones i used this code, do you see any modifications that should be done ?

[MenuItem("Tools/Fix PNG Import Settings")]
private static void FixUnityImportSettings()
{
    // get all paths of .png images in the project.
    var pngImages = AssetDatabase.GetAllAssetPaths ().Where (path => path.EndsWith (".png"));

    foreach (var png in pngImages)
    {
        var importer = AssetImporter.GetAtPath (png) as TextureImporter;

        if (importer != null)
        {
            // Get texture settings (should be done per platform)
            var settings = importer.GetPlatformTextureSettings("Android");

            var format = settings.format;
            var autoFormat = importer.GetAutomaticFormat ("Android");

            // texture was automatically imported with wrong settings...
            if (format == TextureImporterFormat.Automatic)
            {
                // override settings per platform
                settings.overridden = true;

                switch (autoFormat)
                {
                    case TextureImporterFormat.RGB16:
                    case TextureImporterFormat.RGB24:
                    case TextureImporterFormat.PVRTC_RGB4:
                    case TextureImporterFormat.PVRTC_RGB2:
                       
                    case TextureImporterFormat.ETC_RGB4:
                    case TextureImporterFormat.ETC2_RGB4_PUNCHTHROUGH_ALPHA:
                    case TextureImporterFormat.ETC2_RGB4:
                       
                    case TextureImporterFormat.ATC_RGB4:

                        // convert back to RGBA
                        settings.format = TextureImporterFormat.ETC2_RGBA8;
                        importer.SetPlatformTextureSettings (settings);
                        importer.SaveAndReimport ();

                        break;
                }
            }
        }
    }
}

Does it work?

The issue has already been fixed. I managed to track down the fix and have a backport to 5.5 and 5.6 on the way. The only workaround at the moment is to force the format either via script(like above) or in the inspector.

Great. Do you know if this will land into 5.5.2p4 ?

No the cutoff for 5.5.2p4 was last week. It should make it into 5.5.3p1 which is due April 5th I believe.

great. thank you

Hey the fix is now in 5.5.3p1. You will need to re-import the affected assets when you open this version. We have not forced a re-import as this would force all users to re-import all textures which would be quite extreme :hushed:
So just right click the problem assets and pick re-import or re-import all if you have a lot.

1 Like

Thanks @karl_jones I have actually ran my “fix” script on these assets to manually set their import format to whatever i want (RGBA ETC2 8 bit). Is there any simple way to roll that back? i believe i can do that via Git, but just checking with you if you know of anything else?

Also, do you have a rough estimation on when this patch version should be available for download ?

Scheduled for the 5th of April.
If you have manually set the import format then that will be stored in the meta files. You could roll back this info in git like you say or change your import script so it sets them back to automatic format perhaps?

Hi, do you know if the patch should be released today ?

1 Like

5th April is the scheduled date. Its not unusual for it to slip a day. Sometimes if QA find an issue it can take longer.
I’ll ask the release manager tomorrow, if it’s not out by then.