SetPixels not working on transparent pixels

Using Unity 5.6.3p2

I have a Texture2D that has some dynamic shapes colored into it and the background is transparent.
I call GetPixels() to get a section of pixels to modify, and basically just set all of their colors to Color.black;
Then I call SetPixels() on the textures and then use Apply().

The pixels that had color and were not transparent will change to black, but the background part that is transparent, I cannot make it any color it just stays transparent.

Any ideas what I’m doing wrong?

Do you set the alpha value?

Yes and all colors in Color, such as Color.black, use the alpha value.
Also if I set the alpha to 0 then the visible pixels do turn transparent.

Don’t know then. Maybe show some code.

The blue part is the transparent area.

Color[] pixels = texture.GetPixels(left, bottom, right, top);

for(int i=0; i<pixels.length; i++)
{
    pixels[i] = Color.black;
}

texture.SetPixels(left, bottom, right, top, pixels)
texture.Apply()


Figured it out.
This can be caused by the Sprite Renderer’s Draw Mode being set to Simple.

2 Likes