Hi everybody,
I’m having some trouble with Asset Bundles here. I have a script that runs in both the editor and during gameplay, and it is loading an array of 3x3 WWW objects, each one loading an asset bundle. Loading is not a problem, it is working perfectly, my problem is unloading it.
I tried to load it, display the object the asset bundle contained, and keep it in memory until time to unload it, but this messed up when I went from editor to play, as for some reason my object loses reference in the array as soon as I press play, and then Unity complains my asset bundle is already loaded, and WWW fails.
Because of that, I thought, why not load the asset bundle, get the object, and then destroy it right away? I tried this, and this worked nicely in the editor, but as soon as I press play, things get messed up with my 1st load, not loading my terrainData object. I thought, okay, as soon as I’m destroying the asset bundle and www object, it is destroying my TerrainData as well.
Then I thought, okay, if it is being destroyed, I’ll clone it with Instantiate() before destroying it, then there’ll be no reference, and it indeed does clone my terrainData, but destroying all my splatmaps, trees and details.
What I need to know, is there any way to load an asset bundle with WWW, get a terrainData from it (assume it is the only asset in the bundle), destroy it right after loading and STILL get the terrainData, working both in runtime and editor? (sorry I don’t have my code here, at work right now)