Hi.
I use LoadImage() to work with external textures (JPG and PNG files) in my project. It has a problem with texture format preserving. For example I have 8-bit JPG (or PNG) texture (gray) and I want to upload it to Alpha8 format texture using next piece of code:
Texture2D outTexture = new Texture2D( 1, 1, TextureFormat.Alpha8, false, true );
if ( outTexture.LoadImage( atlasRawBytes.bytes, true ) )
{
// use texture..
}
But texture format is overrided to RGB24 after loading. I can use LoadRawTextureData() to upload manually decoded jpg, but c# jpg decoding is too slow.
Could LoadImage() have a flag to preserve specified texture format or to respect file texture format?
Thanks.