Transparency showing as black - textures and images loaded using www

Hi,

I am using the WWW class to load some .png images as textures, which I then apply to programmatically generated meshes. I am setting the texture of the mesh using the game object's MeshRenderer, and I know this is working to a point as the mesh displays the texture, just with transparency as black:

gameObject.GetComponent.<MeshRenderer>().material.mainTexture = texture;

I have a feeling the problem has something to do with the way I'm setting the material up, but I don't know what it is I might be doing wrong.

Any pointers as to why transparency isn't displaying properly would be appreciated.

Thanks,

Wibbs

Maybe it's because you have a standard shader apllied?

You could try to use a simple Transparent/Diffuse shader as the default shader for your object.

I’ve the same problem using Unity 5 beta…
This is my code:-
var www = new WWW(“http://www.tonypec1974.altervista.org/snap_1.jpg”);
// wait until the download is done
yield www;
// assign the downloaded image to the main texture of the object
www.LoadImageIntoTexture(GetComponent.().material.mainTexture);

it shows only black texture
Transparent/Diffuse shader doesn’t work for me

03/04/2015. I’ve solved the issue, isn’t unity problem is a server problem. Some server use a service named Cloufire. This service for speed reason keep in memory old image uploaded on the server without updating.
Deactivate Cloudfire on the server will fix the problem.

you need to be using texture.EncodeToPNG(); very importnat

I know this is an old post. But, I happened across it and decided to place an answer since as of June 19, 2021, the answer to this could also be the following:

Check your Material’s option for Rendering Mode. There is Opaque, Cutout, Fade, and Transparent. If you choose Opaque, any “natural” transparency for the 2D image placed in the Albedo of the material will show as black. It also seems Opaque is selected by default.

I choose the Cutout option because it provides the most sheer edge around the image, which typically suits my needs (2D, sharp edging). But depending on what your needs are, you may wish to play with the setting for a few minutes to see its effects and pick the one that best suits you. Hope this helps!