private static void BuildAssetBundlesXMLManifest(string rootPath) { ABManifest manifest = new ABManifest(); foreach (var abName in AssetDatabase.GetAllAssetBundleNames()) { ABItem aBItem = new ABItem(); aBItem.name = abName; string abFile = Path.Combine(rootPath, abName); aBItem.fileSizeInBytes = new FileInfo(abFile).Length; aBItem.md5 = FileUtils.GetMD5HashFromFile(abFile); aBItem.dependencies = AssetDatabase.GetAssetBundleDependencies(abName, false); manifest.abItems.Add(aBItem); } string manifestXmlFile = Path.Combine(rootPath, ABManifest.FileName); manifest.Serialize(manifestXmlFile); ShowABManifest(manifestXmlFile); }
public static AssetBundle LoadAssetBundle(string abName) { Debug.LogFormat("ABManager.LoadAssetBundleabName:{0}", abName); if (loadedAB.ContainsKey(abName)) { return(loadedAB[abName]); } if (!configs.ContainsKey(abName)) { return(null); } ABItem abItemConfig = configs[abName]; string abFile = Path.Combine(ABRootPath, abItemConfig.name); AssetBundle assetBundle = AssetBundle.LoadFromFile(abFile); Debug.LogFormat("ABManager.LoadAssetBundle real abName:{0} File:{1}", abName, abFile); loadedAB[abName] = assetBundle; foreach (var dependABName in abItemConfig.dependencies) { LoadAssetBundle(abName); } return(assetBundle); }