I’m having memory issues in my Android application. The setup is like this:
1) I have a Scene0 (which is very light, it contains just the camera, global application logic and managers) and it is the one that starts with the app
2) The second scene to run is Scene1, which is loaded asynchronously by a manager without deallocating Scene0 (additive mode). It is quite large and heavy.
3) The third scene, Scene2, is listed in the Build Settings “Scenes in Build” but it is NOT loaded until the user presses a button. Scene2 is totally different from Scene1 (different assets are referenced) and it is heavy aswell.
When i test the app from desktop, everything seems ok. On Android, the app crashes while it is trying to load Scene1. Logcat says it is an “out of memory” problem. Here’s the strange thing: if I remove Scene2 from the Build Settings “Scenes in Build” list, Scene1 is loaded fine.
I tried to analyze the app and the Profiler (linked to the android execution) clearly shows that the Unity internal PreloadManager is asynchronously loading 1GB of assets (when Scene2 is listed in the build scenes) before Scene1 is loaded! Those assets cannot be those part of Scene1 because the app reaches the max available memory and crashes…
What does it mean? Are scenes affecting RAM memory even when they are not loaded? I’m clearly missing something. I’m 100% sure that Scene2 is not loaded by script.
I am using Unity 2019.1.2f1, deploying on Oculus Go