I have been using UnityWebRequest for ages without any problems retrieving images. But when the images are over 4096 pixels wide the handler returns a purple image (but the request success without errors and the amount of data seems correct)
I really need to use UnityWebRequest because it does the texture decompression on the background and I am working in a VR project
Texture2D rawTex = (request.downloadHandler as DownloadHandlerTexture).texture;
Texture2D t = new Texture2D(rawTex.width, rawTex.height);
t.LoadImage(request.downloadHandler.data);
mat.SetTexture("_MainTex", t);
I don’t see how the format relates to the RGB format really. Something as simple as opening the app in paint, and saving a a 1k version loads, but transforming it to >4k doesn’t and that should be the same format? I suspect something related to the buffer size or something like that used internally to decompress the image?
The fix to this bug will only come in 2019.1, since it’s not a “fix”, but an introduction of new API allowing larger numbers.
On old releases you have to manually check the value of the Content-Length header.
I believe internally it’s at least 64-bit variable on all platforms. The issue is only with DownloadHandlerScript, where it’s exposed as 32-bit variable.