- Home /
Question by
DukeZ · Jul 25, 2013 at 06:29 AM ·
sceneassetbundlewwwunload
how to unload asset when load new scene?
I have a scene "Level2" which is packed in assetbundle and is downloaded online. When I called:
private IEnumerator LoadScene (string path)
{
Debug.Log ("LoadSceneFrom:" + path);
WWW sceneDownloader = WWW.LoadFromCacheOrDownload (path, 1);
yield return sceneDownloader;
AssetBundle bundle = sceneDownloader.assetBundle;
Application.LoadLevel ("Level2");
}
It loaded the Level2. But when I stopped the game in Editor, Unity log the error "Resource file has already been unloaded." in the first time. Then if I stop the game in another run, it just crashed.
The Level2 is OK when I run it alone.
Should I call sceneDownloader.Unload(false) sometime after the Level2 is loaded?
BTW, when I change "WWW.LoadFromCacheOrDownload (path, 1)" to "new WWW (path)", everything OK. Why??
Comment
Your answer
Follow this Question
Related Questions
Unload asset bundle make problem 0 Answers
AssetBundle.Unload(false) 2 Answers
Why does a scene loaded from an Asset Bundle returns empty string when getting its name? 0 Answers
AssetBundle.mainAsset 2 Answers