When I tried to destroy an Object loaded from an asset bundle, I get this error message :
"Destroying assets is not permitted to avoid data loss."
If I used DestroyImmediate( obj, true ), Unity crashes.
The code is basically :
Texture2D texture = assetBundle.Load( "textureName" );
assetBundle.Unload( false );
Object.Destroy( texture );
In my project, it would allow me to load assets dynamically and destroy them when I don't need them anymore. In my understanding, the loaded texture is not an asset, it's a bunch of bytes uncompressed from an asset. So I should able to release them to free up memory.
I know there is the AssetBundle.Unload( true ) method, but I need the asset bundle in memory and AFAIK, the whole content of the asset bundle is kept in memory.
Is there a way to get this work ?