Unity5.3.5加载AssetBundle包及依赖
发布时间:2020-12-14 02:10:42 所属栏目:百科 来源:网络整理
导读: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.assetB
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; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |