public static void BuildAssetBundles(BuildTarget buildTarget) { string outputPath = AssetBundleUtility.GetBuildPlatformOutputPath(buildTarget); BuildAssetBundleOptions buildOption = BuildAssetBundleOptions.IgnoreTypeTreeChanges; AssetBundleManifest manifest = BuildPipeline.BuildAssetBundles(outputPath, buildOption, buildTarget); if (manifest != null) { AssetsPathMappingEditor.BuildPathMapping(buildTarget, manifest); VariantMappingEditor.BuildVariantMapping(buildTarget, manifest); BuildPipeline.BuildAssetBundles(outputPath, buildOption, buildTarget); Debug.Log("BuildAssetBundles success!!!"); } AssetDatabase.Refresh(); }
static public void ListAssetbundleDependencis(bool isAll) { if (AssetBundleEditorHelper.HasValidSelection()) { string localFilePath = AssetBundleUtility.GetBuildPlatformOutputPath(EditorUserBuildSettings.activeBuildTarget); localFilePath = Path.Combine(localFilePath, AssetBundleUtility.GetCurPlatformName()); Object[] selObjs = Selection.objects; var depsList = AssetBundleEditorHelper.GetDependancisFormBuildManifest(localFilePath, selObjs, isAll); if (depsList == null) { return; } depsList.Sort(); string depsStr = string.Empty; int i = 0; foreach (string str in depsList) { depsStr += string.Format("[{0}]{1}\n", ++i, str); } string selStr = string.Empty; i = 0; foreach (Object obj in selObjs) { selStr += string.Format("[{0}]{1};", ++i, AssetDatabase.GetAssetPath(obj)); } Debug.Log(string.Format("Selection({0}) directly depends on the following assetbundles:" + "\n-------------------------------------------\n" + "{1}" + "\n-------------------------------------------\n", selStr, depsStr)); } }