- Home /
Deleting www.texture from memory
I am trying to remove www.texture from memory for webgl. Using the code below
GameObject.Destroy(www.texture);
Doesn't remove it from memory. But calling
Resources.UnloadUnusedAssets();
after we destory it seems to work (according to the profiler), but we get "m_instance != 0" constantly, which can be annoying. But testing it in a webgl build, it actually works without the error.
What do we do to properly remove a www.texture from memory?
Thanks for the help!
Answer by Denvery · Jun 26, 2015 at 08:30 PM
Try to write: www.texture = null
; then Resources.UnloadUnusedAssets();
I suppose this will work because UnloadUnusedAssets unloads asset only when there are no references for this asset in the project
You can't assign www.texture... it is a get only property
Answer by alejandroestebanjaime · Jun 28, 2018 at 04:25 PM
Hi, maybe it's a bit late, the correct thing is: Destroy (www.texture) and then www.texture = null
I also had memory problems and I have to apply those lines. Saludos!
Your answer
![](https://koobas.hobune.stream/wayback/20220613201434im_/https://answers.unity.com/themes/thub/images/avi.jpg)