Memory Management Question

Hello there :wink:

I have a doubt I would like to clarify. Imagine I have a game, that features multiple level packs , like 30 levels per pack or so, and each pack uses a different texture atlas. In order to avoid big loading times when player chooses a level , I thought of , loading for example the first level pack atlas as soon as the game starts , while still in menu, and if player chooses other level pack, I would switch the atlas for the correct one, meaning I would unload the 1st level pack texture atlas , and load 2nd level pack texture atlas in its place. Now… I know this works in theory, but I’m not sure how unity handles this stuff in the background, how do I unload the texture ? Is there a way to unload the texture ?

One other question related to this … If I load a new scene , for example , if I go from menu to level, having a variable that references this texture in a script that is not deleted , is all I need to keep the texture loaded ?

What about the assets from the menu ? As long as I load the ingame scene does unity unload them all ?

As you can see, I’m really confused about unity’s way of handling what is in memory…

Can someone help me please? Thanks in advance

As I understand it, if a texture is part of a scene, and you load a new scene, Unity will “unload” the old scene, that is it will destroy all objects that doesn’t have the DontDestroyOnLoad bit set.

/Chris