Unload asset loaded with WWW class

Hi there !

I’m loading textures using WWW right now and I want to get rid of the memory from the loaded items.
I’ve tried to call Destroy on the image loaded, but after looking at the profiler it doesn’t seem to release the memory (and the number of textures doesn’t drop either).

It only frees the memory once I call UnloadUnusedAssets, but it creates an heavy lag spike that is not acceptable in the project. I can’t call UnloadAsset as the asset loaded doesn’t come from disk.
FYI I’m loading the asset from the WWW.bytes and not WWW.texture.

Any ideas ? Thanks !

Problem solved,

[Context] I used those textures to create a sprite object and to set it to a Image component [/Context]

If you want to destroy the texture loaded in memory you will have to destroy the original Texture2D component you used to create the sprite with Sprite.Create. Calling destroy on “mySprite.texture” doesn’t seem to work at all (until you call UnloadUnusedAssets).

So:

Destroy(myTexture2D) > YEA

Destroy(mySprite.texture) > NAY