-
-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Hi ,
This project looks very well written - Thanks for making it open source.
I'm trying to extend your repo with option to generate mipmaps and enable compression on the downloaded texture, so as to reduce the memory usage even with mipmaps enabled. However, I observed few things that are not as per Unity's documentation, details are mentioned below. Would be great if you can help out.
For generating mipmaps and enabling compression, using DownloadHandlerBuffer
is resulting in (>50%) less Memory usage and GC than the recommended DownloadHandlerTexture
.
Note: The above logs are in reverse order to what is usually seen in Unity Editor - top to bottom means most recent to oldest.
But as per documentation:
Finally, DownloadHandlerTexture only allocates managed memory when finally creating the Texture itself, which eliminates the garbage collection overhead associated with performing the byte-to-texture conversion in script.
Here are the codes for both the methods:
- Code to download image using "DownloadHandlerTexture" - GetImageUsingUWRTexture
- Code to download image using "DownloadHandlerBuffer" and enable mipmaps, compression - GetImageUsingUWRBufferAndEnableMipmapsAndCompression
Any thoughts on why this could be happening, mainly the GC aspect?
Also will there be any side effects(in terms of CPU usage, ..) with this approach(using DownloadHandlerBuffer)?