Error when loading Unity Asset.

Hi, I am using Load assetBundle Example. The first loading, it runs ok. But when I load again then I got a error log from UnityEditor (but don’t have any crash and the game is continue) :

“nameSpace.stream
UnityEngine.WWW:get_assetBundle()
<>c__CompilerGenerated1:MoveNext() (at …/3DControl.cs:894)
[/Users/unity-build/Desktop/automatic-build-2/unity/Projects/…/Runtime/Serialize/PersistentManager.cpp line 825]”

And this is my code:

private IEnumerator f_LoadObject(string sURL, string sKey, LoadObjectReturn fReturn) {
	m_currentWWW = new WWW(sURL);
	yield return m_currentWWW;
	if (m_currentWWW.error == null) {
		AssetBundle m_assetBundle = m_currentWWW.assetBundle; // <==I got error at this line.
		m_currentWWW = null;
		if (m_assetBundle!=null) {
			UnityEngine.Object go = m_assetBundle.mainAsset;
			fReturn((GameObject)go, sKey);
		} else
			fReturn(null, sKey);
	} else {
		fReturn(null, sKey);
	}		
}

Can I fix this error?

Sorry, up.

This problem been plaguing my code for months. I just recently fixed it. Before loading the level again, unload the data in the assetBundle.

This happened to me if I were to reload the same level again via Application.LoadLevel() as a game/level reset. During the reset logic before calling Application.LoadLevel(sameLevel), call the assetBundle.Unload(true);

I hope this helps.

–Paul

I also get this error.

nameSpace.stream
UnityEngine.WWW:get_assetBundle()

I’m using AssetBundle for loading in multiple assets that need to be there at the same time though, so I can’t unload them without Unity crashing.

Please can you report this error (menu: Help > Report A Problem).

Ok, it’s been reported. Might there be a work-around for now?