首頁(yè) >頭條 > 正文

      unity_addressable_入門(mén)指南

      2023-03-28 11:06:12來(lái)源:嗶哩嗶哩

      Once you have?installed the Addressables package?in your Unity Project, you can get started.

      譯:一旦你在Unity項(xiàng)目中安裝了Addressables包,你就可以開(kāi)始了。


      (資料圖片)

      The basic steps to using Addressables include:

      譯:使用Addressables的基本步驟包括:

      Make your assets Addressable?譯:讓你的資產(chǎn)具有可尋址性

      Reference and load those assets in code using the Addressables API?譯:使用Addressables API在代碼中引用和加載這些資產(chǎn)

      Build your Addressable assets?譯:構(gòu)建你的Addressable?

      See the?Space Shooter project?in the?Addressables-Sample?repository for an example of a project set up to use Addressable assets.

      譯:請(qǐng)參閱Addressable - sample存儲(chǔ)庫(kù)中的Space Shooter項(xiàng)目,以獲得設(shè)置為使用Addressable資產(chǎn)的項(xiàng)目示例。

      NOTE

      This Getting Started topic doesn't discuss the various ways you can organize your Addressable content. For information on that topic, see?Organizing Addressable Assets.

      譯:本入門(mén)主題不討論組織可尋址內(nèi)容的各種方法。有關(guān)該主題的信息,請(qǐng)參見(jiàn)組織可尋址資產(chǎn)。

      Installation

      To install the Addressables package in your project, use the Unity Package Manager

      譯:要在項(xiàng)目中安裝Addressables包,請(qǐng)使用Unity包管理器

      Open the Package Manager (menu:?Window > Package Manager).譯:Window > Package Manager

      Set the package list to display packages from the?Unity Registry.譯:設(shè)置包列表來(lái)顯示來(lái)自Unity Registry的包。

      3 .Select the Addressables package in the list.譯:在列表中選擇Addressables包

      4.Click?Install(at the bottom, right-hand side of the Package Manager window).譯:?jiǎn)螕鬒nstall(在Package Manager窗口的底部,右邊)。

      To set up the Addressables system in your Project after installation, open the?Addressables Groupswindow and click?Create Addressables Settings.

      譯:要在安裝后在項(xiàng)目中設(shè)置Addressables系統(tǒng),請(qǐng)打開(kāi)Addressables組窗口并單擊Create Addressables Settings。

      When you run the?Create Addressables Settingscommand, the Addressables system creates a folder called,?AddressableAssetsData, in which it stores settings files and other assets it uses to keep track of your Addressables setup. You should add the files in this folder to your source control system. Note that Addressables can create additional files as you change your Addressables configuration. See?Addressables Settings?for more information about the settings themselves.

      譯:當(dāng)您運(yùn)行Create Addressables Settings命令時(shí),Addressables系統(tǒng)創(chuàng)建了一個(gè)名為AddressableAssetsData的文件夾,其中存儲(chǔ)了用于跟蹤Addressables設(shè)置的設(shè)置文件和其他資產(chǎn)。您應(yīng)該將此文件夾中的文件添加到您的源代碼控制系統(tǒng)中。注意,Addressables可以在您更改Addressables配置時(shí)創(chuàng)建額外的文件。有關(guān)設(shè)置本身的更多信息,請(qǐng)參閱Addressables設(shè)置。

      NOTE

      For instructions on installing a specific version of Addressables or for general information about managing the packages in a Project, see?Packages.

      譯:有關(guān)安裝Addressables的特定版本的說(shuō)明或有關(guān)在項(xiàng)目中管理包的一般信息,請(qǐng)參閱包。

      Making an asset Addressable

      You can mark an asset as Addressable in the following ways:

      譯:您可以通過(guò)以下方式將資產(chǎn)標(biāo)記為可尋址:

      Check the?Addressablebox in the asset's Inspector:譯:勾選Addressable選項(xiàng)在Inspector面板中

      Drag or assign the asset to an AssetReference field in an Inspector:譯:將資產(chǎn)拖拽或分配到檢查器中的AssetReference字段

      Drag the asset into a group on the?Addressables Groupswindow:譯:在“Addressables Groups”窗口上將資產(chǎn)拖到一個(gè)組中

      Put the asset in a Project folder that's marked as Addressable:譯:將放入Project文件夾中的資產(chǎn)標(biāo)記為Addressable

      Once you make an asset Addressable, the Addressables system adds it to a default group (unless you place it in a specific group). Addressables packs assets in a group into?AssetBundles?according to your group settings when you make a?content build. You can load these assets using the?Addressables API.

      譯:一旦你將一個(gè)資產(chǎn)設(shè)置為Addressable, Addressables系統(tǒng)就會(huì)將它添加到一個(gè)默認(rèn)組中(除非你將它放在一個(gè)特定的組中)。在構(gòu)建內(nèi)容時(shí),Addressables根據(jù)組設(shè)置將組中的資產(chǎn)打包到AssetBundles中。您可以使用Addressables API加載這些資產(chǎn)。

      NOTE

      If you make an asset in a?Resources folder?Addressable, Unity moves the asset out of the Resources folder. You can move the asset to a different folder in your Project, but you cannot store Addressable assets in a Resources folder.

      譯:如果你讓資源文件夾中的資產(chǎn)可尋址,Unity將資產(chǎn)移出資源文件夾。您可以將資產(chǎn)移動(dòng)到Project中的另一個(gè)文件夾中,但不能將可尋址資產(chǎn)存儲(chǔ)在Resources文件夾中。

      Using an Addressable Asset

      To load an Addressable Asset, you can:

      譯:加載一個(gè)可尋址資產(chǎn),你可以:

      Use an AssetReference referencing the asset譯:使用一個(gè)AssetReference引用資產(chǎn)

      Use its address string譯:使用它的地址字符串

      Use a label assigned to the asset譯:使用標(biāo)簽打包資產(chǎn)

      See?Loading assets?for more detailed information about loading Addressable assets.

      譯:有關(guān)加載可尋址資產(chǎn)的更詳細(xì)信息,請(qǐng)參見(jiàn)加載資產(chǎn)。

      Loading Addressable assets uses asynchronous operations. See?Operations?for information about the different ways to tackle asynchronous programming in Unity scripts.

      譯:加載可尋址資產(chǎn)使用異步操作。關(guān)于在Unity腳本中處理異步編程的不同方法,請(qǐng)參閱操作。

      TIP

      You can find more involved examples of how to use Addressable assets in the?Addressables-Sample repo.

      譯:您可以在Addressable - sample涉及更多有關(guān)如何使用Addressable資產(chǎn)的示例。

      Using AssetReferences

      To use an AssetReference, add an AssetReference field to a MonoBehaviour or ScriptableObject. After you create an object of that type, you can assign an asset to the field in your object's Inspector window.

      譯:為了使用一個(gè)AssetReference,在MonoBehaviour或ScriptableObject中添加一個(gè)AssetReference字段。創(chuàng)建該類型的對(duì)象后,可以將資產(chǎn)分配給對(duì)象的Inspector窗口中的字段。

      NOTE

      If you assign a non-Addressable asset to an AssetReference field, Unity automatically makes that asset Addressable and adds it to your default Addressables group. AssetReferences also let you use Addressable assets in a Scene that isn't itself Addressable.

      譯:如果你將一個(gè)非可尋址資產(chǎn)分配給一個(gè)AssetReference字段,Unity會(huì)自動(dòng)使該資產(chǎn)可尋址,并將其添加到你的默認(rèn)Addressables組中。資產(chǎn)引用還允許你在一個(gè)場(chǎng)景中使用本身不是可尋址的可尋址資產(chǎn)。

      Unity does not load or release the referenced asset automatically; you must load and release the asset using the Addressables API:

      譯:Unity不會(huì)自動(dòng)加載或釋放引用的資產(chǎn);你必須使用Addressables API加載和釋放資產(chǎn):

      See?Loading an AssetReference?for additional information about loading AssetReferences.

      譯:有關(guān)加載資產(chǎn)引用的其他信息,請(qǐng)參見(jiàn)加載資產(chǎn)引用。

      Loading by address

      You can use the address string to load an Asset:

      譯:你可以使用地址字符串來(lái)加載資產(chǎn):

      Remember that every time you load an Asset, you must also release it.

      譯:請(qǐng)記住,每當(dāng)您加載一個(gè)資產(chǎn)時(shí),您也必須釋放它。

      See?Loading a single asset?for more information.

      譯:有關(guān)更多信息,請(qǐng)參見(jiàn)加載單個(gè)資產(chǎn)。

      Loading by label

      You can load sets of assets that have the same label in one operation:

      譯:您可以在一個(gè)操作中加載具有相同標(biāo)簽的資產(chǎn)集:

      See?Loading multiple assets?for more information.

      譯:有關(guān)更多信息,請(qǐng)參見(jiàn)加載多個(gè)資產(chǎn)。

      Managing Addressable assets

      To manage your Addressable assets, use the Addressables?Groupswindow. Use this window to create Addressables groups, move assets between groups, and assign addresses and labels to assets.

      譯:要管理你的Addressable 資源,請(qǐng)使用“Addressables?Groups”窗口。使用此窗口可創(chuàng)建Addressables組,在組之間移動(dòng)資產(chǎn),并為資產(chǎn)分配地址和標(biāo)簽。

      When you first install and set up the Addressables package, it creates a default group for Addressable assets. The Addressables system assigns any assets you mark as Addressable to this group by default. In the early stages of a Project, you might find it acceptable to keep your assets in this single group, but as you add more content, you should consider creating additional groups so that you have better control over which resources your application loads and keeps in memory at any given time.

      譯:當(dāng)您第一次安裝和設(shè)置Addressables包時(shí),它會(huì)為Addressable資產(chǎn)創(chuàng)建一個(gè)默認(rèn)組。Addressables系統(tǒng)默認(rèn)將您標(biāo)記為Addressable的任何資產(chǎn)分配給該組。在項(xiàng)目的早期階段,您可能會(huì)發(fā)現(xiàn)將資產(chǎn)保留在這個(gè)單獨(dú)的組中是可以接受的,但是隨著您添加更多的內(nèi)容,您應(yīng)該考慮創(chuàng)建額外的組,以便您可以更好地控制應(yīng)用程序在任何給定時(shí)間加載和保存在內(nèi)存中的資源。

      Key group settings include:譯:關(guān)鍵組組設(shè)置包括

      Build path: where to save your content after a content build.譯:構(gòu)建路徑:內(nèi)容構(gòu)建后保存內(nèi)容的位置。

      Load path: where your app or game looks for built content at runtime.譯:你的應(yīng)用或游戲在運(yùn)行時(shí)在哪里尋找構(gòu)建內(nèi)容

      NOTE

      You can (and usually should) use Profile variables to set these paths. See?Profiles?for more information.

      譯:您可以(通常應(yīng)該)使用Profile變量來(lái)設(shè)置這些路徑。有關(guān)更多信息,請(qǐng)參閱概要文件。

      Bundle mode: how to package the content in the group into a bundle. You can choose the following options:譯:Bundle模式:如何將組中的內(nèi)容打包成一個(gè)Bundle。您可以選擇以下選項(xiàng)

      One bundle containing all group assets譯:一個(gè)包含所有組資產(chǎn)的包

      A bundle for each entry in the group (particularly useful if you mark entire folders as Addressable and want their contents built together)譯:組中每個(gè)條目的捆綁包(如果您將整個(gè)文件夾標(biāo)記為Addressable并希望將其內(nèi)容構(gòu)建在一起,則特別有用)

      A bundle for each unique combination of labels assigned to group assets譯:分配給組資產(chǎn)的每個(gè)唯一標(biāo)簽組合的包

      Content update restriction: Setting this value appropriately allows you to publish smaller content updates. See?Content update builds?for more information. If you always publish full builds to update your app and don't download content from a remote source, you can ignore this setting.譯:內(nèi)容更新限制:適當(dāng)?shù)卦O(shè)置這個(gè)值可以讓您發(fā)布較小的內(nèi)容更新。有關(guān)更多信息,請(qǐng)參閱內(nèi)容更新構(gòu)建。如果你總是發(fā)布完整的版本來(lái)更新你的應(yīng)用程序,并且不從遠(yuǎn)程源下載內(nèi)容,你可以忽略這個(gè)設(shè)置。

      For more information on strategies to consider when deciding how to organize your assets, see?Organizing Addressable assets.

      譯:有關(guān)在決定如何組織資產(chǎn)時(shí)要考慮的策略的更多信息,請(qǐng)參閱組織可尋址資產(chǎn)。

      For more information on using the Addressables Groups window, see?Groups.

      譯:有關(guān)使用“可尋址組”窗口的詳細(xì)信息,請(qǐng)參見(jiàn)組。

      Building Addressable assets

      The Addressables content build step converts the assets in your Addressables groups into AssetBundles based on the?group settings?and the current platform set in the Editor.

      譯:Addressables內(nèi)容構(gòu)建步驟將Addressables組中的資產(chǎn)轉(zhuǎn)換為基于組設(shè)置和編輯器中設(shè)置的當(dāng)前平臺(tái)的資產(chǎn)包。

      In Unity 2021.2+, you can configure the Addressables system to build your Addressables content as part of every Player build or you can build your content separately before making a Player build. See?Building Addressables content with Player builds?for more information about configuring these options.

      譯:在Unity 2021.2以上版本,你可以配置Addressables系統(tǒng)來(lái)構(gòu)建你的Addressables內(nèi)容作為每個(gè)播放器構(gòu)建的一部分,或者你可以在制作播放器構(gòu)建之前單獨(dú)構(gòu)建你的內(nèi)容。有關(guān)配置這些選項(xiàng)的更多信息,請(qǐng)參見(jiàn)與播放器構(gòu)建構(gòu)建可尋址內(nèi)容。

      If you configure Unity to build your content as pa????build, use the normal?Buildor?Build and Runbuttons on the Editor?Build Settings?window to start a build. Unity builds your Addressables content as a pre-build step before it builds the Player.

      譯:如果你將Unity配置為將內(nèi)容構(gòu)建為播放器構(gòu)建的一部分,請(qǐng)使用編輯器構(gòu)建設(shè)置窗口中的正常構(gòu)建或構(gòu)建并運(yùn)行按鈕來(lái)開(kāi)始構(gòu)建。Unity在構(gòu)建播放器之前構(gòu)建你的Addressables內(nèi)容作為預(yù)構(gòu)建步驟。

      In earlier versions of Unity, or if you configure Unity to build your content separately, you must make an Addressables build using the?Buildmenu on the?Addressables Groupswindow as described in [Making builds]. The next time you build the Player for your project, it uses the artifacts produced by the last Addressables content build run for the current platform. See [Build scripting] for information about automating your Addressables build process.

      譯:在早期的Unity版本中,或者如果你配置Unity來(lái)單獨(dú)構(gòu)建你的內(nèi)容,你必須使用[制作構(gòu)建]中描述的Addressables Groups上的Build菜單進(jìn)行可尋址構(gòu)建。下次為項(xiàng)目構(gòu)建Player時(shí),它將使用上次為當(dāng)前平臺(tái)運(yùn)行的Addressables內(nèi)容構(gòu)建所生成的構(gòu)件。有關(guān)自動(dòng)化Addressables構(gòu)建過(guò)程的信息,請(qǐng)參閱[構(gòu)建腳本]。

      To initiate a content build from the Addressables Groups window:

      譯:要從Addressables Groups窗口啟動(dòng)內(nèi)容構(gòu)建:

      Open the Addressables Groups window (menu:?Windows > Asset Management > Addressables > Groups).譯:打開(kāi)?Addressables Groups窗口,Windows > Asset Management > Addressables > Groups

      Choose an option from the?Buildmenu:譯:從“構(gòu)建”菜單中選擇一個(gè)選項(xiàng):

      New Build: perform a build with a specific build script. Use the?Default Build Scriptif you don't have your own custom one.譯:新構(gòu)建:使用特定的構(gòu)建腳本執(zhí)行構(gòu)建。如果您沒(méi)有自己的自定義構(gòu)建腳本,請(qǐng)使用(Default Build Script)默認(rèn)構(gòu)建腳本

      Update a Previous Build: builds an update based on an existing build. To update a previous build, the Addressables system needs譯:更新以前的構(gòu)建:基于現(xiàn)有的構(gòu)建構(gòu)建一個(gè)更新。要更新以前的版本,Addressables系統(tǒng)需要 the?addressables_content_state.binfile produced by the earlier build. You can find this file in the?Assets/AddressableAssetsData/Platformfolder of your Unity Project. See?Content Updates?for more information about updating content.譯:由早期構(gòu)建生成的addressables_content_state.bin文件。你可以在Unity項(xiàng)目的Assets/AddressableAssetsData/Platform文件夾中找到這個(gè)文件。有關(guān)更新內(nèi)容的更多信息,請(qǐng)參閱內(nèi)容更新。

      Clean Build: deletes cached build files.譯:Clean Build:刪除緩存的構(gòu)建文件

      By default, the build creates files in the locations defined in your?Profile?settings for the?LocalBuildPathand?RemoteBuildPathvariables. The files that Unity uses for your player builds include AssetBundles (.bundle), catalog JSON and hash files, and settings files.

      譯:默認(rèn)情況下,構(gòu)建在配置文件設(shè)置中為L(zhǎng)ocalBuildPath和RemoteBuildPath變量定義的位置中創(chuàng)建文件。Unity用于你的用戶構(gòu)建的文件包括AssetBundles (.bundle),目錄JSON和哈希文件,以及設(shè)置文件。

      WARNING

      In most cases, you should not change the local build or load paths from their default values. If you do, you must copy the local build artifacts from your custom build location to the project's?StreamingAssets?folder before making a Player build. Altering these paths also precludes building your Addressables as part of the Player build.

      譯:在大多數(shù)情況下,不應(yīng)更改本地構(gòu)建或加載路徑的默認(rèn)值。如果你這樣做,你必須復(fù)制本地構(gòu)建工件從您的自定義構(gòu)建位置到項(xiàng)目的StreamingAssets文件夾,然后再進(jìn)行用戶構(gòu)建。改變這些路徑也排除了將你的Addressables構(gòu)建為Player構(gòu)建的一部分。

      If you have groups that you build to the?RemoteBuildPath, it is your responsibility to upload those AssetBundles, catalog, and hash files to your hosting server. (If your Project doesn't use remote content, set all groups to use the local build and load paths.)

      譯:如果你有組,你建立到RemoteBuildPath,這是你的責(zé)任,上傳這些資產(chǎn)包,目錄,和哈希文件到你的主機(jī)服務(wù)器。(如果項(xiàng)目不使用遠(yuǎn)程內(nèi)容,請(qǐng)將所有組設(shè)置為使用本地構(gòu)建和加載路徑。)

      A content build also creates the following files that Addressables doesn't use directly in a player build:

      譯:內(nèi)容構(gòu)建也會(huì)創(chuàng)建以下文件,Addressables不會(huì)直接在用戶構(gòu)建中使用:

      addressables_content_state.bin: used to make a content update build. If you support dynamic content updates, you must save this file after each content release. Otherwise, you can ignore this file.譯:addressables_content_state.bin:用于制作內(nèi)容更新構(gòu)建。如果支持動(dòng)態(tài)內(nèi)容更新,則必須在每次內(nèi)容發(fā)布后保存此文件。否則,您可以忽略該文件

      AddressablesBuildTEP.json: logs build performance data. See?Build Profiling.譯:AddressablesBuildTEP.json:日志構(gòu)建性能數(shù)據(jù)。參見(jiàn)構(gòu)建剖析

      See?Building Addressable content?for more information about how to set up and perform a content build.

      譯:有關(guān)如何設(shè)置和執(zhí)行內(nèi)容構(gòu)建的詳細(xì)信息,請(qǐng)參見(jiàn)構(gòu)建可尋址內(nèi)容。

      Starting a full content build

      To make a full content build:

      譯:要制作完整的內(nèi)容構(gòu)建:

      Set the desired?Platform Targeton the?Build Settingswindow.譯:在Build Settings窗口設(shè)置目標(biāo)平臺(tái)

      Open the?Addressables Groupswindow (menu:?Asset Management > Addressables > Groups).譯:打開(kāi)Addressables Groups窗口,Asset Management > Addressables > Groups

      Choose the__ New Build > Default Build Script__ command from the Build menu of the?Groupswindow.譯:在Groups中選擇New Build?>?Default Build Script

      The build process starts.

      譯:構(gòu)建過(guò)程開(kāi)始。

      After the build is complete, you can perform a player build and upload any remote files from your?RemoteBuildPathto your hosting server.

      譯:構(gòu)建完成后,您可以執(zhí)行用戶構(gòu)建,并將任何遠(yuǎn)程文件從您的RemoteBuildPath上傳到您的托管服務(wù)器。

      IMPORTANT

      If you plan to publish remote content updates without rebuilding your application, you must preserve the?addressables_content_state.binfile for each published build. Without this file, you can only create a full content build and player build, not an update. See?Content update builds?for more information.

      譯:如果您計(jì)劃在不重新構(gòu)建應(yīng)用程序的情況下發(fā)布遠(yuǎn)程內(nèi)容更新,則必須為每個(gè)發(fā)布的構(gòu)建保留addressables_content_state.bin文件。沒(méi)有這個(gè)文件,你只能創(chuàng)建一個(gè)完整的內(nèi)容構(gòu)建和用戶構(gòu)建,而不是更新。有關(guān)更多信息,請(qǐng)參閱內(nèi)容更新構(gòu)建。

      Remote content distribution

      You can use Addressables to support remote distribution of content through a Content Delivery Network (CDN) or other hosting service. Unity provides the Unity Cloud Content Delivery (CCD) service for this purpose, but you can use any CDN or host you prefer.

      譯:您可以使用Addressables通過(guò)內(nèi)容分發(fā)網(wǎng)絡(luò)(CDN)或其他托管服務(wù)來(lái)支持內(nèi)容的遠(yuǎn)程分發(fā)。Unity為此提供了Unity云內(nèi)容交付(CCD)服務(wù),但你可以使用任何你喜歡的CDN或主機(jī)。

      Before building content for remote distribution, you must:

      譯:在構(gòu)建用于遠(yuǎn)程分發(fā)的內(nèi)容之前,您必須:

      Enable the?Build Remote Catalogoption in your AddressableAssetSettings (access using menu:?Windows > Asset Management > Addressables > Settings).譯:在AddressableAssetSettings(使用菜單訪問(wèn))中啟用“生成遠(yuǎn)程目錄”選項(xiàng),?Windows > Asset Management > Addressables > Settings

      Configure the?RemoteLoadPathin the?Profile?you use to publish content to reflect the remote URL at which you plan to access the content.譯:在概要文件中配置用于發(fā)布內(nèi)容的Remotelloadpath,以反映計(jì)劃訪問(wèn)內(nèi)容的遠(yuǎn)程URL

      For each Addressables group containing assets you want to deliver remotely, set the?Build Pathto?RemoteBuildPathand the?Load Pathto?RemoteLoadPath.譯:對(duì)于每個(gè)包含您想要遠(yuǎn)程交付的資產(chǎn)的Addressables組,將構(gòu)建路徑設(shè)置為RemoteBuildPath,將加載路徑設(shè)置為RemoteLoadPath。

      Set desired?Platform Targeton the Unity?Build Settingswindow.譯:在Unity Build Settings窗口中設(shè)置所需的平臺(tái)目標(biāo)。

      After you make a content build (using the Addressables?Groupswindow) and a player build (using the?Build Settingswindow), you must upload the files created in the folder designated by your profile's?RemoteBuildPathto your hosting service. The files to upload include:

      譯:在創(chuàng)建內(nèi)容構(gòu)建(使用Addressables Groups窗口)和用戶構(gòu)建(使用構(gòu)建設(shè)置窗口)后,必須將在配置文件的RemoteBuildPath指定的文件夾中創(chuàng)建的文件上傳到托管服務(wù)。需要上傳的文件包括:

      AssetBundles (name.bundle)譯:

      Catalog (catalog_timestamp.json)譯:

      Hash (catalog_timestamp.hash)譯:

      See?Distributing remote content?for more information.

      譯:有關(guān)更多信息,請(qǐng)參閱分發(fā)遠(yuǎn)程內(nèi)容。

      Incremental content updates

      When you distribute content remotely, you can reduce the amount of data your users need to download for an update by publishing incremental content update builds. An incremental update build allows you to publish remote bundles which contain only the assets that have changed since you last published an update rather than republishing everything. The assets in these smaller, updated bundles override the existing assets.

      譯:當(dāng)您遠(yuǎn)程分發(fā)內(nèi)容時(shí),您可以通過(guò)發(fā)布增量?jī)?nèi)容更新構(gòu)建來(lái)減少用戶為更新需要下載的數(shù)據(jù)量。增量更新構(gòu)建允許您發(fā)布遠(yuǎn)程包,其中只包含自上次發(fā)布更新以來(lái)發(fā)生變化的資產(chǎn),而不是重新發(fā)布所有內(nèi)容。這些較小的更新包中的資產(chǎn)覆蓋現(xiàn)有資產(chǎn)。

      IMPORTANT

      You must turn on the?Build Remote Catalog?option before you publish a player build if you want to have the option to publish incremental updates. Without a remote catalog, an installed application doesn't check for updates.

      譯:如果您希望有發(fā)布增量更新的選項(xiàng),則必須在發(fā)布用戶構(gòu)建之前打開(kāi)生成遠(yuǎn)程目錄選項(xiàng)。如果沒(méi)有遠(yuǎn)程編目,已安裝的應(yīng)用程序?qū)⒉粫?huì)檢查更新。

      For more detailed information about content updates, including examples, see?Content update builds.

      譯:有關(guān)內(nèi)容更新的詳細(xì)信息(包括示例),請(qǐng)參見(jiàn)內(nèi)容更新構(gòu)建。

      Starting a content update build

      To make a content update, rather than a full build:

      譯:要進(jìn)行內(nèi)容更新,而不是完整構(gòu)建:

      On the?Build Settingswindow, set the?Platform Targetto match the target of the previous content build that you are now updating.譯:在“生成設(shè)置”窗口中,將平臺(tái)目標(biāo)設(shè)置為與您現(xiàn)在正在更新的上一個(gè)內(nèi)容生成的目標(biāo)相匹配。

      Open the?Addressables Groupswindow (menu:?Asset Management > Addressables > Groups).譯:打開(kāi)Addressables Groups窗口 通過(guò)Asset Management > Addressables > Groups

      From the?Toolsmenu, run the?Check for Content Update Restrictionscommand. The?Build Data Filebrowser window opens.譯:通過(guò)Tools菜單,運(yùn)行Check for Content Update Restrictions命令Build Data File會(huì)在文件夾中打開(kāi)

      Locate the?addressables_content_state.binfile produced by the previous build. This file is in a subfolder of?Assets/AddressableAssestsDatanamed for the target platform.譯:找到上一個(gè)版本生成的addressables_content_state.bin文件。該文件位于以目標(biāo)平臺(tái)命名的Assets/AddressableAssestsData的子文件夾中。

      Click?Open. The?Content Update Previewwindow searches for changes and identifies assets that must be moved to a new group for the update. If you have not changed any assets in groups set to "Cannot Change Post Release," then no changes will be listed in the preview. (When you change an asset in a group set to "Can Change Post Release," then Addressables rebuilds all the AssetBundles for the group; Addressables does not move the changed assets to a new group in this case.)譯:?jiǎn)螕鬙pen?!?strong>Content Update Preview”窗口搜索更改并識(shí)別必須移動(dòng)到新組以進(jìn)行更新的資產(chǎn)。如果您沒(méi)有更改組中的任何資產(chǎn),設(shè)置為“不能更改發(fā)布后”,則預(yù)覽中不會(huì)列出任何更改。(當(dāng)你將一個(gè)組中的資產(chǎn)設(shè)置為“Can change Post Release”時(shí),Addressables會(huì)為這個(gè)組重新構(gòu)建所有的資產(chǎn)包;在這種情況下,Addressables不會(huì)將更改的資產(chǎn)移動(dòng)到新的組中。)

      Click?Apply Changesto accept any changes.譯:點(diǎn)擊Apply Changes來(lái)改變所有更改

      From the?Buildmenu, run the__ Update a Previous Build__ command.譯:從Build菜單中運(yùn)行Update a Previous Build命令

      Open the?addressables_content_state.binfile produced by the previous build.譯:打開(kāi)上一個(gè)構(gòu)建生成的addressables_content_state.bin文件.

      The build process starts.

      譯:

      After the build is complete, you can upload the files from your?RemoteBuildPathto your hosting server.

      譯:構(gòu)建過(guò)程開(kāi)始。

      IMPORTANT

      Addressables uses the?addressables_content_state.binfile to identify which assets you changed. You must preserve a copy of this file for each published build. Without the file, you can only create a full content build, not an update.

      譯:Addressables使用addressables_content_state.bin文件來(lái)識(shí)別您更改了哪些資產(chǎn)。您必須為每個(gè)發(fā)布的版本保留該文件的副本。如果沒(méi)有該文件,您只能創(chuàng)建完整的內(nèi)容構(gòu)建,而不能創(chuàng)建更新。

      責(zé)任編輯:

      標(biāo)簽:

      免責(zé)聲明

      頭條新聞

      推薦內(nèi)容