Memory Data management not working in my project, Project having 200+ levels with textures as prefabs. Instantiated prefabs and Destroyed prefabs on my conditions. Even I used Clearing cache function in unity and garbage Collection function. I have worked with Memory profiler it shows continuously increment my texture 2D Size in levels… Help me Out… Replies will be appreciated…
Please keep in mind that if you have a LevelManager in the hierarchy that serializes all of the levels then all of the levels will be in memory.
You will need more dynamism to the process of loading/unloading levels. You could try:
- Use different scenes for levels, and additively load them in.
- Put levels in the Resources folder. And call Resources.UnloadUnusedAssets when you destroy a level.
- Use the Addressable system. It’s a little complex due to its async nature. But in personal experience it’s the best way to get some control over memory management.