UnityWebRequestTexture.GetTexture: need mipmaps option

Hi! I’ve got problems in 2d game with quality and performance after update project from Unity 2020.3.45f1 to Unity 2022.3.7f1!

In the game, I draw a scrollable list of pictures (there are quite a lot of them), which I download using UnityWebRequestTexture with flag nonReadable=true. Before the update, everything was fine with this. But after that the quality of the pictures dropped when displayed.
After research, I realized that this was affected by the fix: UUM-26628. Now, when downloading using UnityWebRequestTexture, mipmaps are created. If I want to show a picture at UnityEngine.UI.Image in the original quality, I need to specify a flag nonReadable=false (which doubles the amount of memory used) and recreate the texture without mipmaps and destroy the created texture early, which freezes the frames - and this greatly affects the performance of lists! Just a disaster!

In summary: I use UnityWebRequestTexture to load texture images with flag nonReadable=true to show in scrollable list. Before the update, mipmaps were not created by default. My requirement is that: I don’t need mipmaps in scrollable lists at all when I download pictures using UnityWebRequestTexture or it should be optional! The game is implemented on platforms Android and iOS. For mobile platforms, quality and performance are very important in such moments! Unity development team just force us to use UnityWebRequestTexture so that everything works fine without freezing, but because of this fix everything got messed up!

How should I deal with this situation? Please explain to me how to bypass the creation of mipmaps. For good measure, you need to add mipmaps creation as an option something like this: UnityWebRequestTexture.GetTexture(string uri, bool nonReadable, int mipCount = -1)
I’m sure I’m not the only one who suffers from this!
I hope you can help me and fix this as soon as possible!

1 Like

Submit a feature request.
You can use ImageConversion class to convert image to texture.

Ok, I’ve changed the title to Feature request. And regarding the ImageConversion class - you mean that I need to make a UnityWebRequest and get a bytes array from it. Will this be comparable in performance to UnityWebRequestTexture? I’m not sure. But the mipCount as option is still needed in UnityWebRequestTexture!

UnityWebRequest internally uses the same code, only it does it (mostly) on a background thread, so there will be a performance penalty on the main thread.

I tried ImageConversion.LoadImage to Texture2D from downloadHandler.data, but it’s the same problem: mipmaps is created by default and there is no option to not create it.

How do you create texture? Could you show the code?

This is what I’m trying:

UnityWebRequest unityWebRequest = UnityWebRequest.Get("my url");
Texture2D texture = new Texture2D(2, 2);
ImageConversion.LoadImage(texture, unityWebRequest.downloadHandler.data);
Debug.Log(texture.mipmapCount);

Console output is: 10

And when i call ImageConversion.LoadImage - this cause long time frame on main thread (scrolling becomes laggy).

Try creating texture without mipmaps (pass false to mipChain parameter of the constructor):

It worked but it doesn’t make sense to me because as I wrote above the scroll starts lagging (can’t call it in the background thread). The second point is that in this variant of constructor you cannot specify that the texture should be nonreadeable

Still, bump it up! I need a clear answer from the developers that this needs to be fixed! My expectation is that mipmaps should be optional when using UnityWebRequestTexture. It would be great if this was added in future releases as soon as posible!

1 Like

Did you submit a request for it?
Yes, I agree with you, that it should be optional.

1 Like

Maybe I don’t understand how to do this correctly? This is my first time encountering this. I just changed the tag for this post. Googling does not help to understand how to submit a feature request. Help pls

Submit a bug using Unity Editor, just state in it that it’s a feature request.

Thank you. I sent from the editor

1 Like

I have submitted one too as this is very annoying
I do not want mipmap generations…

I do not want mipmap generations too

1 Like

Was there ever an official bug report for tracking this issue? UUM-26628 is such an awful awful fix to force mipmap on UnityWebRequestTexture… If only they just added a parameter to allow mipmap generation instead of breaking / regressing stuff…

1 Like

@Aurimas-Cernius Please add a mipmap generation option, and/or get the old behaviour back. Do you have received a valid feature request for this?

1 Like

Well, I spent two hours searching for the cause of black borders around some textures, only to find that it’s related to UnityWebRequestTexture.GetTexture creating mipmaps in latest versions of Unity.

It seems to yield the same result as

Texture2D texture = new Texture2D(2, 2, TextureFormat.RGBA32, true);
texture.LoadImage(textureData);

So I need to create the texture with “false” for mipmap and download only raw bytes.

Nice thing - not.

UnityWebRequestTexture.GetTexture is quite useless now.

1 Like

Hope a mipmap parameter gets added soon.
I’m loading textures for a skybox and I don’t want mipmaps either. But I would still like the performance benefits of UnityWebRequestTexture.GetTexture.