Dispose ALL www class assets

Hello, I am trying to find a way/code to dispose ALL www class loads (such as textures, audio and movie files) when Unity Loads a new scene? Is there any script lines that will do this other than manually having to dispose each one? Also is there a way to mass dispose assetbundles too? many thanks! :slight_smile:
~Sean

1 Answer

1

I’m not sure that Resources.UnloadUnusedAssets is going to do what you’re asking if there are still references to these assets lying around (you could look into it). You could write a manager that wraps all the www load calls in your game and stores every asset that gets loaded. Then when you want to clean all that up just call WWWAssetManager.UnloadAll()

For the asset bundles part you WILL have to track the bundles you load so that you can call AssetBundle.Unload. It has a bool parameter which you can read about here:

Thank you! You are a live saver. :)

Can you mark this as the answer if it indeed helped your problem? Thank you, and glad to help!