unity5.6.3打assetbundle的API
// 摘要:
// Build all AssetBundles specified in the editor.
//
// 参数:
// outputPath:
// Output path for the AssetBundles.
//
// assetBundleOptions:
// AssetBundle building options.
//
// targetPlatform:
// Chosen target build platform.
//
// 返回结果:
// The manifest listing all AssetBundles included in this build.
public static AssetBundleManifest BuildAssetBundles(string outputPath, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform);
// 摘要:
// Build AssetBundles from a building map.
//
// 参数:
// outputPath:
// Output path for the AssetBundles.
//
// builds:
// AssetBundle building map.
//
// assetBundleOptions:
// AssetBundle building options.
//
// targetPlatform:
// Target build platform.
//
// 返回结果:
// The manifest listing all AssetBundles included in this build.
public static AssetBundleManifest BuildAssetBundles(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform);
一个assetbundle里面可以有多个资源,例如,我们可以将多个角色prefab打到一个assetbundle文件里。
我们可以批量自动的给我们的资源打assetbundle标签,代码如下:
AssetImporter importer = AssetImporter.GetAtPath(newPath);
importer.SetAssetBundleNameAndVariant(fileName, variant);
if (isSetNull)
{
importer.SetAssetBundleNameAndVariant(null, null);
}
importer.SaveAndReimport();
要清晰的区分两个概念:
1.从磁盘文件加载到内存中的Asset文件
2.具有对于1的引用的内存对象