- Home /
Unloading unused assets automatically?
While debugging my latest build in XCode, I noticed the following message popping-up whenever I load a new scene:
Unloading 25 unused Assets to reduce memory usage. Loaded Objects now: 245. System memory in use: 0 B. Unloading 2 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)
How can I find out which assets are being unloaded and why? I am not doing any unloading on purpose anywhere yet, so I'm curious as to why this is happening...
As always, thanks for your time and help! Stephane
Slightly out of topic, but do you have a problem with your splash screen on your iPhone app? When I play my game on my own device it gets stuck on the splash screen.
I had a few hangups on the splash screen before but it was because of a bug in my code or a build with missing files. Other then that, I never get stuck on it
Hi is there a way to avoid certain assets form being unloaded when the assets.unloadunusedassets is called ?
DHivakar .. sure, DontDestroyOnLoad is a basic of using Unity. Get in to it!
Answer by jonas-echterhoff · Sep 05, 2011 at 12:12 PM
Loading levels calls Resources.UnloadUnusedAssets, to clean up memory used by assets no longer needed for the new level. This is expected, and needed so you won't eventually run out of memory when you are loading lots of levels with lots of assets.
Thanks for the answer jonas! Quick question, how can I find out which assets are being unloaded?
There's no way to list the assets being unloaded. However, you could do FindObjectsOfType(typeof(Object)), and compare the results before and after loading a level to find out.
Your answer
![](https://koobas.hobune.stream/wayback/20220612201948im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
click change scene help! 2 Answers
Scene object scripting 1 Answer
scene loading 100's of scenes 3 Answers
how to move between scenes 1 Answer