Unloading a streamed scene stored in an asset bundle.

I am dynamically downloading a scene from a web server to the local client. Once the player is done with the scene, it is unloaded by using the Application.Load(...) method to load up the next scene. When the scene is unloaded, does unity automatically remove all of the resources from memory? Or will this not occur until I physically call the unload method on the asset bundle itself.

The real question is, does the asset bundle act as an pointer to a package of data on the hard drive. Or is the full file always loaded into memory 100% of the time? I have a scenario were players will be traveling back an forth between levels a lot. Therefore, I need to make sure the memory is released between levels, but the data is cached so that I can quickly load the level again later without needing to download it again (within a single visit to the website). It's alright if the data needs to download again the next time the user visits the website.

For optimal memory usage call Unload() on the asset bundle as well. If you happen to need it again, you can still grab it again trough www.assetBundle.

Basically AssetBundle is a "Object" that contains binary representation of lots of stuff in it. The asset bundle itself can be loaded, but that doesn't mean the objects that the bytes in the assetbundle described are loaded. Only the bytes are.

Once you Load something from an assetbundle, the bytes get deserialized into a new Object. (GameObject, or a Component, or a Texture2D, etc).

Once you created all the objects from the bytes in the assetbundle that you need, you can unload the assetbundle again to free up some memory.

You don't need to manually unload the objects created from the bytes in the assetbundles. Unity will automatically unload them when you load a new scene. (Assuming you didn't DontDestroyOnLoad them.)

Hope that helps, Lucas