- 2、对于每个捆绑包,将Asset Delivery更改为**「Install Time」、「Fast Follow」或「On Demand」**。解决任何错误或依赖项并关闭窗口。
-
3、选择Google > Build Android App Bundle以构建应用程序包。
-
4、(可选)配置你的应用程序包以支持不同的纹理压缩格式。
常见的纹理压缩格式:
-
DDS 或 S3TC:有时称为 DXTC 或 DXTn。OpenGL 支持此格式的三种形式。
-
ETC1:大多数设备都支持此格式。这种格式不支持透明度,但游戏可将第二个纹理文件用于 Alpha 通道组件。
-
ETC2:支持 GLES3 的所有设备均支持此格式。
-
PVRTC:iOS 游戏常用的格式,在某些 Android 设备上也受支持。
-
ASTC:专为取代之前的格式而设计的新格式。比先前的格式更加灵活,因为它支持各种块大小。使用这种格式可以帮助您优化游戏大小。
支持的格式及支持相应格式设备所占的百分比:
使用 API 配置资产包
你可以通过编辑器脚本配置资产交付,这些脚本可以作为自动构建系统的一部分运行。
使用 AssetPackConfig 该类来定义要包含在 Android App Bundle 构建中的资产,以及模式。这些资产包不需要包含 AssetBundle。
public void ConfigureAssetPacks {
// Creates an AssetPackConfig with a single asset pack, named
// examplePackName, containing all the files in path/to/exampleFolder.
var assetPackConfig = new AssetPackConfig();
assetPackConfig.AddAssetsFolder(“examplePackName”,
“path/to/exampleFolder”,
AssetPackDeliveryMode.OnDemand);
// Configures the build system to use the newly created assetPackConfig when
// calling Google > Build and Run or Google > Build Android App Bundle.
AssetPackConfigSerializer.SaveConfig(assetPackConfig);
// Alternatively, use BundleTool.BuildBundle to build an App Bundle from script.
BuildBundle(new buildPlayerOptions(), assetPackConfig);
}
你还可以使用类中的静态 BuildBundle 方法Bundletool生成带有资产包的 Android App Bundle,给定 「BuildPlayerOptions」 和 「AssetPackConfig」。