Memory Leaks - UnUsed Textures and Materials

Hello Guys,

I have searched around but could not find this question asked, please guide me if i have missed any post.

We are having few memory leaks when we were switching between scenes.
When going from Scene A to Scene B and then back to Scene A, we are seeing few extra textures loaded which were not used in Scene A. The textures and materials were from Scene B passed to Scene A.

I would like to know on what basis the unity unloads the textures, materials.
Is there any utility which lets me know of all the Textures Materials and their Dependencies. I have found the resource checker but it was not displaying all the textures. Many of them were missing. So please let me know if any good Memory utility is available.

Thanks a lot,
Vijay

Try using Resources.UnloadUnusedAssets to clean them up.
The new memory profiler should also help.

I was using Resources.UnloadUnusedAssets. It wasnt helping. i was manually deleting the material through the code. that wasnt helping either.

An other trick I have heard people use is to load an empty scene in between each of your scenes.

Karl

Actually I wouldn’t call that a trick but indeed a must have as long as you want to make sure that your assets are getting unloaded correctly. Unity works in a way that it will still keep things from the previous scene in memory. Only having an interstitial scene which basically forwards you to the scene you actually want to load will make sure that the assets are getting unloaded.