Hi all, simply making a new project and attaching the following code to a gameobject:
float time = 0;
void Update()
{
time += Time.deltaTime;
if(time >= .5f)
{
time = 0;
Texture2D screenShot = new Texture2D((int)1000, (int)1000, TextureFormat.RGBA32, false);
}
}
Anyone know why this makes the memory continuously increase? As far as I can tell, you cannot deallocate a Texture2D’s memory – it handles itself if it is not referenced by anything. The previous “screenshot” is not referenced by anything after the next iteration of the Update loop.