Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

The editor ignores alpha of imported PNG file

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

  1. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    The editor ignores an alpha channel of the attached PNG file. The imported sprite appears all white.
    The previous version of the editor imported the same file correctly. The image editors also open this file without problems.

    It seems Unity has trouble with alpha in PNG file with 8-bit colormap.

    Affected versions: 5.5.2p2, 5.5.2p3, 5.6.0f1.
    Previously in 5.5.1 and earlier it worked fine.

    Issue #892300.
     

    Attached Files:

  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    How is this image imported? for us, i am getting a black background instead of a transparent one.
     
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I just tried opening the file you attached, getting a white background (5.5.2p2)
    upload_2017-3-20_13-56-3.png
     
  4. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    It depends what color is assigned for these transparent pixels. In this case white background must be transparent.
     
  5. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    159
    I got reply from QA:
     
  6. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    the question is what is a "next version of unity" ? is it 5.5 future patch release or 5.6 ?
     
  7. Lost-in-the-Garden

    Lost-in-the-Garden

    Joined:
    Nov 18, 2015
    Posts:
    176
    we had the same issue. The fix that worked for us was to convert all PNGs to 32bit PNGs. The fastest way to do that is via image magic on the command line:
    >> convert someImage.png PNG32:someImage.png

    With a little bash scripting magic you can easily do that for full folders. On windows I used the new windows bash.
     
    amjaliks likes this.
  8. amjaliks

    amjaliks

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

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I posted an editor script on that thread that you linked that should take care of it (or at least, be a starting point for creating such an automated script).
     
  10. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Awesome. we will give that a try !