the memory is not to reduce if destroy gameobject and unload assetbundle or Resources.unloadUnuseAssets and so on,
is it a bug?
if i have too many levels and a lot of objects the memory will not enough
the memory is not to reduce if destroy gameobject and unload assetbundle or Resources.unloadUnuseAssets and so on,
is it a bug?
if i have too many levels and a lot of objects the memory will not enough
To make sure that the memory will be released, you can explicitly set all references to null. And then call System.GC()
.
The OnDestroy method can be really useful for that purpose:
public class MyClass : MonoBehaviour
{
private Object reference1;
private SomeOtherClass reference2;
// ...
void OnDestroy()
{
this.reference1 = null;
if (this.reference2 != null)
{
this.reference2.CleanupMethod();
}
this.reference2 = null;
}
}
i’m sure that all references to null,
and also used System.Gc.Collect();
but the memory not reduce equals it increased
i used
assetsbundle.Unload(true);
WWW.Dispose();
Resources.UnloadUnUseAssets();
System.Gc.Collect();
and Application.LoadLevel();
that i will say the memory is increased probability