How to LoadImage with transparency?

Right now I am using following code to load textures from files in my game(and I want to load them like this):

        var bytes = File.ReadAllBytes(AbsolutePath);
        var texture = new Texture2D(1, 1,TextureFormat.ARGB32,false);
        texture.LoadImage(bytes);

The thing is that this texture has transparent regions and they become black after loading texture. How can I load partially transparent texture using Texture2D.LoadImage?

Hi @Zylkowski_a ,
If you are loading a PNG image, have you checked the loaded textures’ alpha channel to see if there’s some data?

I don’t really know how should I check it there’s some data. And yes I am loading PNG btw

Use Texture2D.GetPixel. At least in my quick test just a moment ago I could load in alpha channel from a PNG with similar code.

@Olmi Unity say that this pixel is RGBA(0.000, 0.000, 0.000, 1.000), I tried with one that was RGBA(0.000, 0.000, 0.000, 0.000) and both of them are black ingame

Well, if the image data is correct,it should show up. But that depends also on your shader.
I just tried loading my test png from disk and it does show up correctly when I apply that image as a sprite.

I used code like this:

var bytes = File.ReadAllBytes(AbsolutePath);
var texture = new Texture2D(1, 1,TextureFormat.ARGB32,false);
texture.LoadImage(bytes);
Sprite sprite = Sprite.Create(texture, new Rect(0,0,texture.width, texture.height), new Vector2(0,0));
GetComponent<SpriteRenderer>().sprite = sprite;

Result looks like this:
5920466--632597--alpha_circle.PNG

But I’d definitely also check the image and try some other tool/plugin for saving like SuperPNG in Photoshop. I think @bgolus has suggested it too sometime in the past as a good option, if I remember correctly.