static public int GetAllDependencies(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.AssetBundleManifest self = (UnityEngine.AssetBundleManifest)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.GetAllDependencies(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public static AssetBundleManifest Create(UnityEngine.AssetBundleManifest manifest) { AssetBundleManifest result = new AssetBundleManifest() { Version = DateTime.Now.ToString("yyyyMMddHHmmss") }; if (manifest == null) { return(result); } List <string> assetbundleNames = new List <string>(); assetbundleNames.AddRange(manifest.GetAllAssetBundles()); foreach (var name in assetbundleNames) { AssetBundleInfo info = new AssetBundleInfo() { AssetBundleName = name, Hash128 = manifest.GetAssetBundleHash(name).ToString() }; info.AssetPaths.AddRange(AssetDatabase.GetAssetPathsFromAssetBundle(name)); var dependencies = manifest.GetAllDependencies(name); foreach (var depName in dependencies) { info.Dependencies.Add(assetbundleNames.IndexOf(depName)); } result.Infos.Add(info); } return(result); }
static public int GetAllDependencies(IntPtr l) { try { UnityEngine.AssetBundleManifest self = (UnityEngine.AssetBundleManifest)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.GetAllDependencies(a1); pushValue(l, ret); return(1); } catch (Exception e) { return(error(l, e)); } }
public void AddUnityManifest(UnityEngine.AssetBundleManifest manifest) { if (manifest == null) { return; } string[] inOriginList = manifest.GetAllAssetBundles(); foreach (var origin in inOriginList) { allAssetBundles.Add(origin); allDependencies.Add(origin, manifest.GetAllDependencies(origin)); allHash.Add(origin, manifest.GetAssetBundleHash(origin)); } }
static int GetAllDependencies(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); UnityEngine.AssetBundleManifest obj = (UnityEngine.AssetBundleManifest)ToLua.CheckObject <UnityEngine.AssetBundleManifest>(L, 1); string arg0 = ToLua.CheckString(L, 2); string[] o = obj.GetAllDependencies(arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static IEnumerator LoadAssetBundle(string Fdirctory, string FassetBundleName) { string[] dps = assetBundleManifest.GetAllDependencies(FassetBundleName); AssetBundle[] temp = new AssetBundle[dps.Length]; for (int i = 0; i < dps.Length; i++) { WWW www = WWW.LoadFromCacheOrDownload(dps[i], assetBundleManifest.GetAssetBundleHash(dps[i])); yield return(www); temp[i] = www.assetBundle; } WWW tar = WWW.LoadFromCacheOrDownload(Fdirctory + FassetBundleName, assetBundleManifest.GetAssetBundleHash(FassetBundleName)); yield return(tar); AssetBundle t = tar.assetBundle; }
public static IEnumerator LoadAssetBundle() { string url = Application.streamingAssetsPath + "/AssetBundles/"; string path = CFG.WWWstreamingAssetsPathPrefix + url + "AssetBundles"; WWW nwww = WWW.LoadFromCacheOrDownload(path, 0); yield return(nwww); if (string.IsNullOrEmpty(nwww.error)) { AssetBundle mab = nwww.assetBundle; UnityEngine.Object g0 = mab.LoadAsset("AssetBundleManifest"); AssetBundleManifest main = g0 as AssetBundleManifest; mab.Unload(false); string[] dps = main.GetAllDependencies("Commen"); AssetBundle[] temp = new AssetBundle[dps.Length]; foreach (var item in dps) { WWW durkl = WWW.LoadFromCacheOrDownload(item, main.GetAssetBundleHash(item)); yield return(durkl); temp[0] = durkl.assetBundle; } WWW tar = WWW.LoadFromCacheOrDownload(CFG.WWWstreamingAssetsPathPrefix + url + "Commen", main.GetAssetBundleHash("Commen"), 0); yield return(tar); AssetBundle t = tar.assetBundle; Sprite _tt = t.LoadAsset <Sprite>("20"); GameObject g = new GameObject(); var r = g.AddComponent <SpriteRenderer>(); r.sprite = _tt; } else { #if UNITY_EDITOR || Development Debuger.Log(nwww.error); #endif } }
/// <summary> /// 加载资源包 /// </summary> /// <param name="dirctory"></param> /// <param name="assetBundleName"></param> /// <returns></returns> public static IEnumerator LoadAssetBundle(string dirctory, string assetBundleName) { ///如果assetBundleManifest为空,结束加载。 if (assetBundleManifest == null) { yield break; } string[] dps = assetBundleManifest.GetAllDependencies(assetBundleName); AssetBundle[] temp = new AssetBundle[dps.Length]; for (int i = 0; i < dps.Length; i++) { WWW www = WWW.LoadFromCacheOrDownload(dps[i], assetBundleManifest.GetAssetBundleHash(dps[i])); yield return(www); temp[i] = www.assetBundle; } WWW tar = WWW.LoadFromCacheOrDownload(dirctory + assetBundleName, assetBundleManifest.GetAssetBundleHash(assetBundleName)); yield return(tar); AssetBundle t = tar.assetBundle; }