Hi everyone,
I try to load a png (2048px x 2560px) file into a Texture2D with the function LoadRawTextureData :
private Texture2D ImportModelTexture(string filePath)
{
Texture2D texture = new Texture2D(2048, 2560, TextureFormat.RGB24, false);
byte[] bytes = m_localStorage.LoadFileAsBytes(filePath);
texture.LoadRawTextureData(bytes);
texture.Apply();
return texture;
}
But this exception append:
UnityException: LoadRawTextureData: not enough data provided (will result in overread).
I had tested different TextureFormat and still the same exception… I think i miss something, but I don’t know what.
Someone can help me?
Best,
Alexis
PS : I don’t used LoadImage because this function is to slow…