Version: 2022.1
Applying default presets to Assets by folder
AssetBundle 工作流程

AssetBundle

AssetBundle 是一个存档文件,包含可在运行时由 Unity 加载的特定于平台的非代码资源(比如模型、纹理、预制件、音频剪辑甚至整个场景)。AssetBundle 可以表示彼此之间的依赖关系;例如,一个 AssetBundle 中的材质可以引用另一个 AssetBundle 中的纹理。为了提高通过网络传输的效率,可以根据用例要求(LZMA 和 LZ4)选用内置算法选择来压缩 AssetBundle。

AssetBundle 可用于可下载内容(DLC),减小初始安装大小,加载针对最终用户平台优化的资源,以及减轻运行时内存压力。

Note: An AssetBundle can contain the serialized data of an instance of a code object, such as a ScriptableObject. However, the class definition itself is compiled into one of the Project assemblies. When you load a serialized object in an AssetBundle, Unity finds the matching class definition, creates an instance of it, and sets that instance’s fields using the serialized values. This means that you can introduce new items to your game in an AssetBundle as long as those items do not require any changes to your class definitions.

AssetBundle 中有什么?

“AssetBundle”可以指两种不同但相关的东西。

首先是磁盘上的实际文件。这称为 AssetBundle 存档。AssetBundle 存档是一个容器,就像文件夹一样,可以在其中包含其他文件。这些附加的文件包含两种类型:

  • 一个序列化文件,其中包含分解为各个对象并写入此单个文件的资源。
  • 资源文件,这是为某些资源(纹理和音频)单独存储的二进制数据块,允许 Unity 高效地在另一个线程上从磁盘加载它们。

“AssetBundle”也可以指代通过代码进行交互以便从特定 AssetBundle 存档加载资源的实际 AssetBundle 对象。该对象包含您添加到此存档文件的资源的所有文件路径的映射。

有关更多信息,请参阅关于资产、资源和 AssetBundle 的教程。

注意:“AssetBundle Manager”是早期 Unity 版本使用的工具,通过这个工具可以方便地使用 AssetBundle 来简化资源管理。从 Unity 2018.2 版开始,应改用 Addressable Assets 包,因为 Unity 已弃用 AssetBundle Manager。

Applying default presets to Assets by folder
AssetBundle 工作流程
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961