For weeks now I have been working on memory issues, I can see that the memory increases between scenes, this causes issues on consoles, I tried everything I can to make it go down, an empty scene loaded after a normal scene doubles it’s size for absolutely no reason, I checked for everything I could find online, (like static elements keeping it alive for example), I’m comparing everything in the memory profiler and see no reason for any of this to exist in a totally empty scene, this is the code I’m using to try to find the cause, you can see that I’m unloading everything many times and it is proving to be totally useless, I also tried to Unload the scene (and many things more that I tried over the days):
public class RedirectToSceneIndexTest : MonoBehaviour
{
public int sceneIndex;
// Start is called before the first frame update
void Start()
{
Resources.UnloadUnusedAssets();
StartCoroutine(LoadSceneAfter());
}
IEnumerator LoadSceneAfter()
{
Resources.UnloadUnusedAssets();
//SceneManager.UnloadSceneAsync(SceneManager.GetActiveScene().buildIndex);
yield return new WaitForSecondsRealtime(12);
SceneManager.LoadScene(sceneIndex);
Resources.UnloadUnusedAssets();
yield return new WaitForSecondsRealtime(1);
Resources.UnloadUnusedAssets();
}
}
with this code I first load an empty scene that has nothing but a camera, the scene is 466 mb, a normal game scene is loaded, then the empty scene again, now that scene is 1gb+, is there a way to clear the memory and make the empty scene go back to it’s original size?




