Search Unity

No alpha for .png textures after upgrade to 5.5.2p2

Discussion in 'General Graphics' started by liortal, Mar 20, 2017.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    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.

    upload_2017-3-20_13-46-38.png
     
  2. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Is there any fix for this ?
     
  4. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    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.
     
  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @amjaliks did you report this as a bug by any chance ?
     
  6. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    @liortal, yes, I did. Case 892300.

    I got replay from QA recently:
     
  7. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,288
    Hi. We are working on getting this fix into a patch for both 5.5 and 5.6.
     
    amjaliks likes this.
  8. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    do you know when this patch should land? also can you confirm that 5.5.1 does not suffer from this issue ?
     
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,288
    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.
     
  10. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    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?
     
  11. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @karl_jones i used this code, do you see any modifications that should be done ?
    Code (CSharp):
    1. [MenuItem("Tools/Fix PNG Import Settings")]
    2. private static void FixUnityImportSettings()
    3. {
    4.     // get all paths of .png images in the project.
    5.     var pngImages = AssetDatabase.GetAllAssetPaths ().Where (path => path.EndsWith (".png"));
    6.  
    7.     foreach (var png in pngImages)
    8.     {
    9.         var importer = AssetImporter.GetAtPath (png) as TextureImporter;
    10.  
    11.         if (importer != null)
    12.         {
    13.             // Get texture settings (should be done per platform)
    14.             var settings = importer.GetPlatformTextureSettings("Android");
    15.  
    16.             var format = settings.format;
    17.             var autoFormat = importer.GetAutomaticFormat ("Android");
    18.  
    19.             // texture was automatically imported with wrong settings...
    20.             if (format == TextureImporterFormat.Automatic)
    21.             {
    22.                 // override settings per platform
    23.                 settings.overridden = true;
    24.  
    25.                 switch (autoFormat)
    26.                 {
    27.                     case TextureImporterFormat.RGB16:
    28.                     case TextureImporterFormat.RGB24:
    29.                     case TextureImporterFormat.PVRTC_RGB4:
    30.                     case TextureImporterFormat.PVRTC_RGB2:
    31.                        
    32.                     case TextureImporterFormat.ETC_RGB4:
    33.                     case TextureImporterFormat.ETC2_RGB4_PUNCHTHROUGH_ALPHA:
    34.                     case TextureImporterFormat.ETC2_RGB4:
    35.                        
    36.                     case TextureImporterFormat.ATC_RGB4:
    37.  
    38.                         // convert back to RGBA
    39.                         settings.format = TextureImporterFormat.ETC2_RGBA8;
    40.                         importer.SetPlatformTextureSettings (settings);
    41.                         importer.SaveAndReimport ();
    42.  
    43.                         break;
    44.                 }
    45.             }
    46.         }
    47.     }
    48. }
     
  12. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,288
    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.
     
  13. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Great. Do you know if this will land into 5.5.2p4 ?
     
  14. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,288
    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.
     
  15. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    great. thank you
     
  16. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,288
    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 :eek:
    So just right click the problem assets and pick re-import or re-import all if you have a lot.
     
    Lost-in-the-Garden likes this.
  17. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    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 ?
     
  18. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,288
    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?
     
  19. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Hi, do you know if the patch should be released today ?
     
    amjaliks likes this.
  20. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,288
    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.
     
  21. rankornfeld

    rankornfeld

    Joined:
    Sep 29, 2016
    Posts:
    57
    I have 5.5.3f1 and it is still happening.
    Re import does not help either.
     
  22. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    We need to wait for 5.5.3p1. It was scheduled for yesterday, but it seems there is some delay. @karl_jones, any updates on this?
     
  23. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,288
    Hi.
    It has been delayed a little. Should be out today or before the end of tomorrow at the latest.
    Internally we went through a large reformat of our codebase(whitespace, tabs and spaces etc) and this week we did the same to 5.5 which delayed things a little. So it's now with QA to finalise.
     
    amjaliks likes this.
  24. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    oh, seems harmless ... :) hahaha
     
    karl_jones likes this.
  25. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    The issue is fixed in 5.5.3p1. Thanks!
     
    karl_jones likes this.