Unity5.3.5加载AssetBundle包及依赖

IEnumerator loadScene(string sceneName)
	{
		string mainPath = "file://" + Application.streamingAssetsPath + "/AssetBundle/" + "AssetBundle";
		WWW www1 = new WWW (mainPath);	
		yield return www1;
		if(www1.error == null)
		{
			AssetBundle mainAB = www1.assetBundle;
			AssetBundleManifest abm = (AssetBundleManifest)mainAB.LoadAsset("AssetBundleManifest");
			mainAB.Unload (false);
			if (abm == null) {
				Debug.Log ("abm is null");
				yield return null;
			} else {
				string[] depNames = abm.GetAllDependencies ("a.assetbundle");
				Debug.Log ("depNames length = " + depNames.Length.ToString());
			}	
		}

		string fileFullPath = "file://" + Application.streamingAssetsPath + "/AssetBundle/" + sceneName+"."+AB_END;
		WWW www = new WWW (fileFullPath);	
		yield return www;
		if (www.error == null) 
		{
			AssetBundle abScene=www.assetBundle;

			SceneManager.LoadScene (sceneName);
		}
		else 
		{
			Debug.LogError ("fileFullPath:"+fileFullPath+" error:" + www.error);
		}
		www.dispose ();
		www = null;
	}

相关文章

迭代器模式(Iterator)迭代器模式(Iterator)[Cursor]意图...
高性能IO模型浅析服务器端编程经常需要构造高性能的IO模型,...
策略模式(Strategy)策略模式(Strategy)[Policy]意图:定...
访问者模式(Visitor)访问者模式(Visitor)意图:表示一个...
命令模式(Command)命令模式(Command)[Action/Transactio...
生成器模式(Builder)生成器模式(Builder)意图:将一个对...