Hi,
I work at a big project with more than 350 textures. And only like 20 should be in the memory.
I have problems to delete the already loaded textures out of the memory.
var mainTextureTemp = new Texture2D(Global.photoSize, Global.photoSize);
mainTextureTemp = UnityEngine.Resources.Load(sourceLocation, Texture2D);
//DestroyImmediate (Plane.renderer.material.mainTexture);
Plane.renderer.material.mainTexture = new Texture2D(Global.photoSize, Global.photoSize);
Plane.renderer.material.mainTexture = mainTextureTemp;
This script blows up the memory (by 70 MB) every time I run it.
If I uncomment the commented line I get an error message:
“Destroying assets is not permitted to avoid data loss.”
Though the memory is (basically (like 5 MB still seems to stay every time)) cleaned then…
How I clean the memory proper ?
BTW… I noticed the same behavior with:
www.LoadImageIntoTexture(renderer.material.mainTexture);