Alpha for "Fade" render mode ignored when loading PNG texture dynamically
Hi! When loading a prepared image PNG asset as Texture2d, say from the Resources folder, while using the Standard Shader in Rendering Mode "Fade", the PNG alpha values will be correctly used to make the underlying mesh transparent at those parts. (Alpha Source "Input Texture Alpha" is the default, after all.)
However, when doing the same, but loading a texture dynamically from a remote place on the hard disk during runtime (say, from a caching folder where we download www images people provide), the alpha of the very same PNG is now ignored. Here's some of the sample code, but nothing we change around seems to affect this issue:
const int standInSize = 4;
// like this
imageTexture = new Texture2D(standInSize, standInSize);
imageTexture.LoadImage( File.ReadAllBytes(cacheFilePath) );
// or this
bool mipmap = false;
imageTexture = new Texture2D(standInSize, standInSize, TextureFormat.RGBA32, mipmap);
byte[] imageBytes = File.ReadAllBytes(cacheFilePath);
ImageConversion.LoadImage(imageTexture, imageBytes);
How can we ensure the PNG's alpha is being used for this dynamic texture? Thanks!
Side note: ... and using Texture2D.CreateExternalTexture(... , System.IntPtr ...), in case that's meant to help, crashes Unity immediately (Unity 2017.2, stable).