Version: 2022.1

BuildPipeline.BuildAssetBundle

切换到手册
Obsolete public static bool BuildAssetBundle (Object mainAsset, Object[] assets, string pathName, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform);
Obsolete public static bool BuildAssetBundle (Object mainAsset, Object[] assets, string pathName, out uint crc, BuildAssetBundleOptions assetBundleOptions, BuildTarget targetPlatform);

参数

mainAsset 允许您指定一个可方便地使用 AssetBundle.mainAsset 进行检索的特定对象。
assets 要写入捆绑包的一组资源。
pathName 压缩资源包的目标写入位置的文件名。
assetBundleOptions 自动包括依赖项或始终包括完整的资源,而不仅仅是确切的引用对象。
targetPlatform 要构建捆绑包的平台。
crc 可选的 crc 输出参数可用于获取生成的 AssetBundle 的 CRC 校验和,该校验和可用于在使用 UnityWebRequestAssetBundle.GetAssetBundle 下载 AssetBundle 时验证其内容。

描述

构建一个资源包。

This API is obsolete, BuildPipeline.BuildAssetBundles should be used instead. Creates a compressed unity3d file that contains a collection of assets. AssetBundles can contain any asset found in the project folder. This lets you stream resource data of any type, fully setup Prefabs, textures, meshes, animations, any type of asset shown in the project window. All paths are relative to the project folder, for example "Assets/MyTextures/hello.png".
Note that asset bundles built for standalone targets cannot be loaded by applications built for mobile platforms and vice versa. Furthermore, bundles are not compatible between iOS and Android platforms.

如果构建成功,该函数将返回布尔值 true,否则返回 false。

See Also: BuildPipeline.BuildAssetBundles, AssetBundle, DownloadHandlerAssetBundle.