Releasing assets loaded from asset bundle

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 ?

DestroyImmediate should in theory do what you want. It certainly should not crash. Can you submit a bug report so we can take a look?

Edit: I had a look at the bug report. Crashing here is a bug and we'll have it fixed. But, to actually solve your problem at hand, what you should do is just to lose all references to the Texture, and then call Resources.UnloadUnusedAssets().