unity_addressable_Building content(构建内容)
A content build processes your Addressables groups to produce the content catalog, [runtime settings], and the AssetBundles that contain your assets. Addressables uses these files to load content at runtime.
译:一个内容构建过程会处理您的Addressables组,生成内容目录,[运行时设置]和包含您资产的AssetBundles。Addressables使用这些文件在运行时加载内容。
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.
译:您可以配置Addressables系统在每次Player构建时构建Addressables内容,或者在制作Player构建之前单独构建您的内容。有两种内容类别:本地内容和远程内容。本地内容由Addressables自动管理,而远程内容必须上传到托管服务器。Group设置确定该组属于哪个类别。项目Addressable Asset Settings中的Build Addressables on Player Build设置指定了如何构建Addressables内容。可以从Groups窗口顶部的工具栏中的Build菜单中访问构建命令。
If you configure Unity to build your content as part of the Player build, use the normal Build or Build and Run buttons on the Editor Build Settings window to start a build. You can also invoke the Editor on the command line, passing in one of the -buildPlatformPlayer
options or use an API such as BuildPipeline.BuildPlayer to start the build. In all cases, Unity builds your Addressables content as a pre-build step before building the Player.
译:如果将内容作为Player构建的一部分构建,则使用Editor Build Settings窗口上的正常Build或Build and Run按钮启动构建。也可以在命令行上调用Editor,传递一个-buildPlatformPlayer选项或使用诸如BuildPipeline.BuildPlayer之类的API来启动构建。在所有情况下,Unity在构建Player之前作为预构建步骤构建您的Addressables内容。
If you configure Unity to build your content separately, you must start the Addressables build using the Build menu on the Addressables Groups window 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.
译:如果将内容单独构建,则必须使用Addressables Groups窗口上的Build菜单启动Addressables构建,如Making builds中所述。下一次为项目构建Player时,它将使用上次Addressables内容构建的当前平台的产物。有关自动化Addressables构建过程的信息,请参见构建脚本。
Your content build can produce two general categories of content:
译:内容构建可以产生两种一般类别的内容:
Local content: content that's included directly in your player build. The Addressables system manages local content automatically as long as you use the default build path for your local content. If you change the local build path, you must copy the artifacts from the local build path to the project's
Assets/StreamingAssets
folder before making a Player build.译:本地内容:直接包含在播放器构建中的内容。只要使用本地内容的默认构建路径,Addressables系统就会自动管理本地内容。如果更改了本地构建路径,则必须将产物从本地构建路径复制到项目的Assets/StreamingAssets文件夹中,然后才能进行Player构建Remote content: content that's downloaded from a URL after your application is installed. It is your responsibility to upload remote content to a hosting server so your application can access it the designated URL (specified by your RemoteLoadPath).译:远程内容:安装应用程序后从URL下载的内容。您需要将远程内容上传到托管服务器,以便应用程序可以访问指定URL(由您的RemoteLoadPath指定)。
See Build artifacts for more information about files produced by a content build.
译:有关内容构建产生的文件的更多信息,请参见Build artifacts。
Your Group settings determine which category a group belongs to; the active Profile determines the specific paths and URLs that the Addressables system uses to build and load the content. (Your Addressable Asset settings also contain options that affect your content builds, such as whether to build remote content at all.)
译:Group设置确定一个组属于哪个类别;活动配置文件确定Addressables系统用于构建和加载内容的特定路径和URL。 (Addressable Asset设置还包含影响内容构建的选项,例如是否完全构建远程内容。)
You can start builds from a script as well as from the Groups window. See Build scripting for more information on how to extend building Addressable content.
译:您可以从脚本和Groups窗口开始构建。有关如何扩展构建Addressable内容的更多信息,请参见构建脚本。
The Addressables system includes the following build scripts:
译:Addressables系统包括以下构建脚本:
Default Build Script: performs a full content build based on Group, Profile, and Addressables system settings.译:默认构建脚本:基于组、配置文件和Addressables系统设置执行完整内容构建。
Update a Previous Build: performs a differential content build to update a previously created build.译:更新先前的构建:执行差分内容构建以更新先前创建的构建。
Play Mode scripts: the Play Mode scripts are technically build scripts and control how the Editor accesses your content in Play Mode. See Play Mode Scripts for more information.译:Play Mode脚本:Play Mode脚本技术上是构建脚本,控制编辑器在Play Mode中访问内容的方式。有关更多信息,请参见Play Mode Scripts
The build scripts also provide a function to clear the cached files they create. You can run these functions from the Build > Clean Build menu of the Groups window.
译:构建脚本还提供清除它们创建的缓存文件的功能。您可以从Groups窗口的Build > Clean Build菜单运行这些功能。 使用Player构建构建Addressables内容
Building Addressables content with Player builds
When you modify Addressable assets during development, you must rebuild your Addressables content before you build the Player. You can run the Addressables content build as a separate step before building a Player or you can run both the Addressables content build and the Player build together.
译:在开发过程中修改Addressable资源时,您必须在构建Player之前重新构建Addressables内容。您可以在构建Player之前作为单独的步骤运行Addressables内容构建,也可以同时运行Addressables内容构建和Player构建。
Building Addressables content together with the Player can be convenient, but does increase build time, especially on large projects, since this rebuilds the Addressables content even when you haven't modified any assets. If you don't change your Addressables content between most builds, consider disabling this option.
译: 将Addressables内容与Player一起构建可能很方便,但会增加构建时间,特别是在大型项目中,因为即使您没有修改任何资产,这也会重新构建Addressables内容。如果您在大多数构建之间不更改Addressables内容,请考虑禁用此选项。
The Build Addressables on Player Build setting in the Project Addressable Asset Settings specifies which option to use for building Addressables content. You can choose the appropriate option for each Project or defer to the global Preferences setting (which you can find in the Addressables section of your Unity Editor Preferences). When you set a Project-level setting, it applies to all contributors who build the Project. The Preferences setting applies to all Unity Projects that don't set a specific value.
译:Project Addressable Asset Settings中的Build Addressables on Player Build设置指定用于构建Addressables内容的选项。您可以为每个项目选择适当的选项,也可以推迟到全局首选项设置(在Unity编辑器首选项的Addressables部分中找到)。当您设置项目级别的设置时,它适用于构建项目的所有贡献者。首选项设置适用于没有设置特定值的所有Unity项目。
NOTE
Building Addressables on Player Build requires Unity 2021.2+. In earlier versions of Unity, you must build your Addressables content as a separate step.
译:在Unity 2021.2+中构建Player Build需要构建Addressables。在早期版本的Unity中,您必须将Addressables内容构建为单独的步骤。
Build commands
Access build commands from the Build menu on the toolbar at the top of the Groups window.
译:从Groups窗口顶部的工具栏的Build菜单中访问构建命令。

New Build: choose a build script to run a full content build. The Addressables package includes one build script, Default Build Script. If you create custom build scripts, you can access them here (see Build scripting).译:New Build:选择一个构建脚本来运行完整的内容构建。Addressables包括一个构建脚本,即默认构建脚本。如果您创建了自定义构建脚本,您可以在此处访问它们(请参见构建脚本)。
Update a Previous Build: run a differential update based on an earlier build. An update build can produce smaller downloads when you support remote content distribution and publish updated content. See Content update builds.译:Update a Previous Build:基于先前的构建运行差分更新。更新构建可以在支持远程内容分发并发布更新的内容时产生较小的下载量。请参见内容更新构建。
Clean Build: choose a command to clean existing build cache files. Each build script can provide a clean up function, which you can invoke from this menu. (See Build scripting.)译:Clean Build:选择一个命令来清除现有的构建缓存文件。每个构建脚本都可以提供清理功能,您可以从此菜单中调用它们。(请参见构建脚本。)