- Home /
Transparent PNG Image shows up black
I have a PNG image that is completely transparent. There is no color in it at all.
I have this image being used on a UI Image gameobject.
This used to show up completely blank as intended. It is a place holder for other images that I swap in.
In the latest 2018.2 version 2018.2.21 the image is showing up as all black instead of transparent.
If I simply add a single pixel of any color anywhere in the image then it is transparent again except for that pixel.
I don't want some stray pixel, so I would like to know how to fix this.
Can someone tell me how?
@Hotshot10101 Have you tried reimporting the image into Unity?
Yes. I even created a brand new image from scratch and it did the same thing.
Answer by xxmariofer · Apr 05, 2019 at 02:08 PM
hello, pretty sure nothing changed atleast since version 2017, since you said you changed your project version most likely your image properties got reimported in a different way. click your png image go to the compression part in the import settings and change compresion to None. Unity just shows the image you are passing so 100% your transparent image is being painted when compressing.
Looks like it was the compression type. I changed my output target to iOS and the compress type changes to RGBA PVRTC 4 bits. At that point the images are fine and show transparent. When I change the target to Android the compression changes to RGBA ETC2 8 bits. At that point the images all turn black. If I then set the compression to none they become transparent. So is there something wrong with ETC2 8 bits or is that expected behavior?
i am not really familiar with compression algorithms, but they can lose information when trying to compress the images, i imagine that the way the algorithm works doesnt let you empty pngs, just leaving one uncompressed empty png will not affect your build size but for sure other compression algorithms may work for you :)
Answer by Vollmondum · Apr 05, 2019 at 01:22 PM
If that's a material, simply edit Alpha cutoff, or change mode to Fade
It is not a material. It is a simple PNG that I am using on a UI Image object.
i think i am missing something, because all the UI images are "recolored" but it should not appear black, just white, cant you just set the alpha property of the image to 0? if is just for a placeholder it should work
I need to swap out the image with a real image. If I set the alpha channel on the UI Image object to 0 then when I swap out the image for one I want to show up then that image won't show unless I change the alpha back to not 0. I know I could do that, but that is not the point. The point is that a transparent image should show up transparent with alpha set to 255. There is a bug of some kind and I am trying to get an answer on getting it fixed or if something changed on purpose. This used to work. I have been working on this app for a year and it was fine until a few weeks ago when I upgraded to 2018.2.21.
Answer by hyupri · Jun 30, 2021 at 12:52 PM
Make sure to export PNG image from Editor as RGBA and in Unity Inspector check the "Alpha is Transparency"