BuildAssetBundleOptions.DeterministicAssetBundle 确定资源包

BuildAssetBundleOptions.DeterministicAssetBundle

Description描述

Builds an asset bundle using a hash for the id of the object stored in the asset bundle.

编译资源包使用一个哈希表储存对象ID在资源包中。

This allows you to rebuild an asset bundle and reference assets in it directly. When rebuilding the asset bundle the objects in it are guaranteed to have the same id after rebuilding the asset bundle. Due to it being a 32 bit hash space, if you have a lot of objects in the asset bundle it will increase the potential for hash conflicts. Unity will give an error and not build the asset bundle in that case. The hash is based on the GUID of the asset and the local id of the object in the asset. DeterministicAssetBundle are also slower to load from than normal asset bundles, this is because the threaded background loading API usually expects objects to be ordered in a way that makes reading reduce seeking. With DeterministicAssetBundles that is not possible.

这使您可以重建的资产包,并直接引用资源。当重建资源包对象,在重建之后保证有相同的ID。由于它是一个32位的哈希表空间,如果在资源包有许多对象,这将增加潜在哈希表冲突。Unity将给出一个错误,而不在这种情况下编译。哈希表是基于资源的GUID和对象的自身ID。DeterministicAssetBundle加载被标准资源包慢,这是因为线程后台加载API通常期望对象排序的方式,这会使读取加少寻址。

最后修改:2011年7月17日 Sunday 18:44

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。