Unity_Addressable_Build artifacts()
A?content build?creates files in several locations; Unity doesn't include every file in a built player. Typically, Unity includes files associated with local content in the built player and excludes files associated with remote content.
譯:內(nèi)容構(gòu)建會在多個(gè)位置創(chuàng)建文件;Unity不會將每個(gè)文件都包含在已構(gòu)建的玩家中。通常,Unity會將與本地內(nèi)容相關(guān)聯(lián)的文件包含在已構(gòu)建的玩家中,并排除與遠(yuǎn)程內(nèi)容相關(guān)聯(lián)的文件。
Most of the files associated with local content are located in the?Library/com.unity.addressables
?folder. This is a special subfolder in the?Library
?folder which Unity uses to store Addressables files. For more information about the?Library
?folder, see?Importing assets.
譯:大多數(shù)與本地內(nèi)容相關(guān)聯(lián)的文件位于Library/com.unity.addressables文件夾中。這是Library文件夾中的一個(gè)特殊子文件夾,Unity用于存儲Addressables文件。有關(guān)Library文件夾的更多信息,請參閱導(dǎo)入資產(chǎn)。
Artifacts included in the player
During a player build, the Addressables system copies the following files from the?Library/com.unity.addressables/aa/<AddressablesPlatform>
?folder to the?StreamingAssets?folder:
譯:在構(gòu)建玩家時(shí),Addressables系統(tǒng)會將以下文件從Library/com.unity.addressables/aa/文件夾復(fù)制到StreamingAssets文件夾中:
Local AssetBundles (
.bundle
): according to your group, profile, and platform settings. By default, these files are located in the?BuildTarget?subfolder. To change the build location of the bundle files produced by a group, modify the?Build & Load Paths?setting.譯:本地AssetBundle(.bundle):根據(jù)您的組、配置文件和平臺設(shè)置。默認(rèn)情況下,這些文件位于BuildTarget子文件夾中。要更改組生成的bundle文件的生成位置,請修改“生成和加載路徑”設(shè)置。settings.json
: contains Addressables configuration data used at runtime.譯:settings.json:包含運(yùn)行時(shí)使用的Addressables配置數(shù)據(jù)。catalog.json
: the content catalog used to locate and load assets at runtime (if no newer remote catalog is available). For more information about catalogs, see?Content catalogs.譯:catalog.json:用于在運(yùn)行時(shí)定位和加載資產(chǎn)的內(nèi)容目錄(如果沒有更新的遠(yuǎn)程目錄可用)。有關(guān)目錄的更多信息,請參閱內(nèi)容目錄。AddressablesLink/link.xml
: prevents the Unity linker from stripping types used by your assets. For more information about code stripping, see?Managed Code Stripping. In Unity version 2021.2 and later, this file temporarily copied the?AddressableAssetSettings.ConfigFolder, or the?Assets/Addressables_Temp
?folder if no settings file exists.譯:AddressablesLink/link.xml:防止Unity鏈接器剝離您的資產(chǎn)使用的類型。有關(guān)代碼剝離的更多信息,請參閱托管代碼剝離。在Unity版本2021.2及更高版本中,此文件暫時(shí)復(fù)制AddressableAssetSettings.ConfigFolder,或者如果不存在設(shè)置文件,則為Assets/Addressables_Temp文件夾。
For a full list of platform names, see?AddressablesPlatform.
譯:有關(guān)平臺名稱的完整列表,請參閱AddressablesPlatform。
Artifacts not included in the player
Remote content
Files used for remote content should be uploaded to a hosting server. By default these files are located in the?ServerData
?folder.
譯:用于遠(yuǎn)程內(nèi)容的文件應(yīng)上傳到托管服務(wù)器。默認(rèn)情況下,這些文件位于ServerData文件夾中。
The files are:
譯:這些文件是:
Remote AssetBundles (
.bundle
): according to your group, profile, and platform settings. By default these files are located in the?BuildTarget?subfolder. To change the build location of the files produced by a group, modify the?Build & Load Paths?setting.譯:遠(yuǎn)程AssetBundle(.bundle):根據(jù)您的組、配置文件和平臺設(shè)置。默認(rèn)情況下,這些文件位于BuildTarget子文件夾中。要更改組生成的文件的生成位置,請修改“生成和加載路徑”設(shè)置。catalog_{timestamp or player version}.json
: a remote catalog which when downloaded will override the local catalog. This file is only created if the?Build Remote Catalogs?option in?Content update settings?is enabled. To change the build location of this file modify the?Build & Load Paths?in Content update settings. By default the filename includes the timestamp of the build. To use a version number instead, specify the value of the?Player Version Override?in?Catalog settings. For more information about catalogs, see?Content catalogs.譯:catalog{timestamp or player version}.json:當(dāng)下載時(shí)將覆蓋本地目錄的遠(yuǎn)程目錄。僅在啟用了Content update settings中的Build Remote Catalogs選項(xiàng)時(shí)才會創(chuàng)建此文件。要更改此文件的生成位置,請修改“生成和加載路徑”中的設(shè)置。默認(rèn)情況下,文件名包括生成的時(shí)間戳。要使用版本號,請?jiān)贑atalog設(shè)置中指定Player Version Override的值。有關(guān)目錄的更多信息,請參閱內(nèi)容目錄。catalog_{timestamp or player version}.hash
: a file used to check whether the remote catalog has changed since the last time a client app downloaded it. Just like the remote catalog file, this file is only created if the?Build Remote Catalogs?option in?Content update settings?is enabled. To change the build location of this file modify the?Build & Load Paths?in Content update settings. By default the filename includes the timestamp of the build. To use a version number instead, specify the value of the?Player Version Override?in?Catalog settings. For more information about catalogs, see?Content catalogs.譯:catalog{timestamp or player version}.hash:用于檢查自上次客戶端應(yīng)用程序下載遠(yuǎn)程目錄以來是否已更改遠(yuǎn)程目錄。與遠(yuǎn)程目錄文件一樣,僅在啟用Content update settings中的Build Remote Catalogs選項(xiàng)時(shí)才會創(chuàng)建此文件。要更改此文件的生成位置,請修改“生成和加載路徑”中的設(shè)置。默認(rèn)情況下,文件名包括生成的時(shí)間戳。要使用版本號,請?jiān)贑atalog設(shè)置中指定Player Version Override的值。有關(guān)目錄的更多信息,請參閱內(nèi)容目錄。 內(nèi)容狀態(tài)文件
Content State File
The?addressables_content_state.bin
?file is used for making a?content update build. If you are supporting dynamic content updates, you must save this file after each full content build that you release. Otherwise, you can ignore this file.
譯:地址addressablescontentstate.bin文件用于制作內(nèi)容更新構(gòu)建。如果您支持動態(tài)內(nèi)容更新,則必須在發(fā)布每個(gè)完整內(nèi)容構(gòu)建后保存此文件。否則,您可以忽略此文件。
By default this file is located in?Assets/AddressableAssetsData/<AddressablesPlatform>
. See?AddressablesPlatform?for all platform names. To change the build location of the file specify the value of the?Content State Build Path?in?Content update settings.
譯:默認(rèn)情況下,此文件位于Assets/AddressableAssetsData/中。有關(guān)所有平臺名稱,請參閱AddressablesPlatform。要更改文件的生成位置,請?jiān)贑ontent update settings中指定Content State Build Path的值。
NOTE
It is recommended to check this file into version control and create a new branch each time a player build is released.
譯:建議將此文件簽入版本控制,并在每次發(fā)布玩家構(gòu)建時(shí)創(chuàng)建一個(gè)新分支。
Diagnostic Data
Additional files can be created to collect data about the content build.
譯:可以創(chuàng)建其他文件來收集有關(guān)內(nèi)容構(gòu)建的數(shù)據(jù)。
The files are:
譯:這些文件包括:
Library/com.unity.addressables/AddressablesBuildTEP.json
: build performance data. See?Build profiling.譯:Library/com.unity.addressables/AddressablesBuildTEP.json:構(gòu)建性能數(shù)據(jù)。請參閱構(gòu)建分析。Library/com.unity.addressables/buildlayoutreport
: information about AssetBundles produced by the build. See?Build layout report.譯:Library/com.unity.addressables/buildlayoutreport:構(gòu)建生成的AssetBundles的信息。請參閱構(gòu)建布局報(bào)告。 內(nèi)容目錄
Content catalogs
Content catalogs are the data stores Addressables uses to look up an asset's physical location based on the key(s) provided to the system. Addressables builds a single catalog for all Addressable assets. The catalog is placed in the?StreamingAssets?folder when you build your application player. The local catalog can access remote as well as local assets, but if you want to update content between full builds of your application, you must create a remote catalog.
譯:內(nèi)容目錄是Addressables用于根據(jù)系統(tǒng)提供的鍵查找資產(chǎn)的物理位置的數(shù)據(jù)存儲。Addressables為所有Addressable資產(chǎn)構(gòu)建一個(gè)單獨(dú)的目錄。當(dāng)構(gòu)建應(yīng)用程序播放器時(shí),該目錄位于StreamingAssets文件夾中。本地目錄可以訪問遠(yuǎn)程和本地資產(chǎn),但如果您想在應(yīng)用程序的完整構(gòu)建之間更新內(nèi)容,則必須創(chuàng)建遠(yuǎn)程目錄。
The remote catalog is a separate copy of the catalog that you host along with your remote content. Ultimately, Addressables only uses one of these catalogs. A hash file contains the hash (a mathematical fingerprint) of the catalog. If a remote catalog is built and it has a different hash than the local catalog, it is downloaded, cached, and used in place of the built-in local catalog. When you produce a?content update build, the hash is updated and the new remote catalog points to the changed versions of any updated assets.
譯:遠(yuǎn)程目錄是目錄的一個(gè)單獨(dú)副本,您需要與遠(yuǎn)程內(nèi)容一起托管。最終,Addressables僅使用其中一個(gè)目錄。哈希文件包含目錄的哈希(數(shù)學(xué)指紋)。如果構(gòu)建了遠(yuǎn)程目錄并且其哈希與本地目錄不同,則會下載該目錄,緩存并用作內(nèi)置本地目錄的替代品。當(dāng)您生成內(nèi)容更新構(gòu)建時(shí),哈希將更新,并且新的遠(yuǎn)程目錄將指向任何更新資產(chǎn)的已更改版本。
NOTE
You must enable the remote catalog for the full player build that you publish. Otherwise, the Addressables system does not check for a remote catalog and thus cannot detect any content updates. See?Enabling the remote catalog.
譯:必須為您發(fā)布的完整播放器構(gòu)建啟用遠(yuǎn)程目錄。否則,Addressables系統(tǒng)不會檢查遠(yuǎn)程目錄,因此無法檢測任何內(nèi)容更新。請參閱啟用遠(yuǎn)程目錄。
Although Addressables produces one content catalog per project, you can load catalogs created by other Unity Projects to load Addressable assets produced by those Projects. This allows you to use separate Projects to develop and build some of your assets, which can make iteration and team collaboration easier on large productions. See?Managing catalogs at runtime?for information about loading catalogs.
譯:雖然Addressables每個(gè)項(xiàng)目只生成一個(gè)內(nèi)容目錄,但可以加載其他Unity項(xiàng)目創(chuàng)建的目錄以加載這些項(xiàng)目生成的Addressable資產(chǎn)。這使您可以使用單獨(dú)的項(xiàng)目來開發(fā)和構(gòu)建某些資產(chǎn),這可以使大型制作的迭代和團(tuán)隊(duì)協(xié)作更加容易。有關(guān)加載目錄的信息,請參閱在運(yùn)行時(shí)管理目錄。
Catalog settings
There are a variety of settings used for catalogs:
譯:有許多用于目錄的設(shè)置:
Catalog settings: options used to configure local and remote catalogs譯:目錄設(shè)置:用于配置本地和遠(yuǎn)程目錄的選項(xiàng)
Content update settings: options used to configure the remote catalog only譯:內(nèi)容更新設(shè)置:僅用于配置遠(yuǎn)程目錄的選項(xiàng)
To minimize the catalog size, use the following settings:
譯:為了將目錄大小最小化,請使用以下設(shè)置:
Compress the local catalog. If your primary concern is how big the catalog is in your build, there is an option in?Catalog settings?called?Compress Local Catalog. This option builds catalog that ships with your game into an AssetBundle. Compressing the catalog makes the file itself smaller, but note that this does increase catalog load time.譯:壓縮本地目錄。如果您關(guān)心目錄在構(gòu)建中的大小,目錄設(shè)置中有一個(gè)名為Compress Local Catalog的選項(xiàng)。此選項(xiàng)會將隨游戲一起發(fā)布的目錄打包到AssetBundle中。壓縮目錄會使文件本身變小,但請注意,這會增加目錄加載時(shí)間。
Disable built-in scenes and Resources. Addressables provides the ability to load content from Resources and from the built-in scenes list. By default this feature is on, which can bloat the catalog if you do not need this feature. To disable it, select the "Built In Data" group within the Groups window (Window?>?Asset Management?>?Addressables?>?Groups). From the settings for that group, you can uncheck "Include Resources Folders" and "Include Build Settings Scenes". Unchecking these options only removes the references to those asset types from the Addressables catalog. The content itself is still built into the player you create, and you can still load it via legacy API.譯:禁用內(nèi)置場景和資源。Addressables提供了從資源和內(nèi)置場景列表中加載內(nèi)容的功能。默認(rèn)情況下,此功能處于啟用狀態(tài),如果您不需要此功能,則可能會使目錄膨脹。要禁用它,請?jiān)凇癎roups”窗口(窗口>資產(chǎn)管理>Addressables>Groups)中選擇“Built In Data”組。從該組的設(shè)置中,您可以取消選中“包括資源文件夾”和“包括構(gòu)建設(shè)置場景”。取消選中這些選項(xiàng)僅會從Addressables目錄中刪除對這些資產(chǎn)類型的引用。內(nèi)容本身仍會構(gòu)建到您創(chuàng)建的播放器中,并且您仍可以通過傳統(tǒng)API加載它。
There are several group settings that can help reduce the catalog size, such as?Internal Asset Naming Mode. For more information see?Advanced Group settings.譯:有幾個(gè)組設(shè)置可以幫助減少目錄大小,例如內(nèi)部資產(chǎn)命名模式。有關(guān)更多信息,請參閱高級組設(shè)置。
Shared AssetBundles
In addition to the bundles created from your?AddressableAssetGroups
, a build can produce specialized bundles called "shared AssetBundles". These are the?unitybuiltinshaders
?AssetBundle and the?MonoScript
?AssetBundle.
譯:除了根據(jù)AddressableAssetGroups創(chuàng)建的bundle之外,構(gòu)建還可以產(chǎn)生稱為“共享AssetBundles”的專業(yè)bundle。這些是unitybuiltinshaders AssetBundle和MonoScript AssetBundle。
The former is generated if any built-in shaders are used by assets included in the build. All Addressable assets that reference a shader that is built-in with the Unity Editor, such as the Standard Shader, do so by referencing this specialized shader AssetBundle. The naming method of the built-in shader bundle can be changed using the?Shader Bundle Naming Prefix?option in?Addressables Build settings.
譯:前者是在構(gòu)建中包含任何內(nèi)置著色器時(shí)生成的。所有引用Unity編輯器內(nèi)置著色器(例如標(biāo)準(zhǔn)著色器)的Addressable資產(chǎn)都是通過引用此專用著色器AssetBundle來實(shí)現(xiàn)的??梢酝ㄟ^Addressables Build settings中的Shader Bundle Naming Prefix選項(xiàng)更改內(nèi)置著色器bundle的命名方法。
The latter can be toggled on or off by changing the?MonoScript Bundle Naming Prefix?option in?Addressables Build settings. The?MonoScript
?bundle has naming options listed here, which are typically used in multi-project situations. It is used to build?MonoScript
?behaviors into AssetBundles that can be referenced as a dependency.
譯:后者可以通過更改Addressables Build settings中的MonoScript Bundle Naming Prefix選項(xiàng)來切換開關(guān)。MonoScript bundle列出了這里的命名選項(xiàng),通常用于多項(xiàng)目情況。它用于將MonoScript行為構(gòu)建到AssetBundle中,可作為依賴項(xiàng)引用。
Shared AssetBundles derive their build options from the default?AddressableAssetGroup
. By default this group is named?Default Local Group (Default)?and uses local build and load paths. In this case the shared bundles cannot be updated as part of a Content Update, and can only be changed in a new player build. The Check for Content Update Restrictions tool will fail to detect the changes to the bundle because it is only generated during the content build. Therefore if you plan on making content changes to the shared bundles in the future, set the default group to use remote build and load paths and set its?Update Restriction?to?Can Change Post Release.
譯:共享AssetBundles從默認(rèn)的AddressableAssetGroup中派生其構(gòu)建選項(xiàng)。默認(rèn)情況下,此組名為“Default Local Group(Default)”,并使用本地構(gòu)建和加載路徑。在這種情況下,共享bundle無法作為內(nèi)容更新的一部分進(jìn)行更新,只能在新的播放器構(gòu)建中更改。Check for Content Update Restrictions工具將無法檢測到bundle的更改,因?yàn)樗鼉H在內(nèi)容構(gòu)建期間生成。因此,如果您計(jì)劃將來對共享bundle進(jìn)行內(nèi)容更改,請將默認(rèn)組設(shè)置為使用遠(yuǎn)程構(gòu)建和加載路徑,并將其Update Restriction設(shè)置為Can Change Post Release。