Start scene with 300mb, finish - 550mb, where are the others 250?
With each launch a leak more and more…
Simple script:
using UnityEngine;
class Creator : MonoBehaviour
{
GameObject go;
void Start()
{
go = Resources.Load(@"Sprite") as GameObject;
}
void Update()
{
for (int i = 0; i < 1000; ++i)
{
Instantiate(go);
}
}
}
You creating 1000 objects in every frame that’s why this code is very very bad. You need to create objects in start or another specific void not update or anything repeated void
Ummmm, do you not realize that your 1000 GameObjects you are creating every frame are going to use memory? The memory isn’t leaking, you’re just using it. If you destroy the GameObjects the memory should free up when the garbage collector hits.