欢迎光临散文网 会员登陆 & 注册

Unity_Addressable_Profiles(配置文件)

2023-04-01 20:38 作者:unity_某某师_高锦锦  | 我要投稿

A profile contains a set of variables used by the Addressables build scripts. These variables define information such as where to save build artifacts and where to load data at runtime. You can add custom profile variables to use in your own build scripts.

译:一个profile包含了Addressables构建脚本所需要的一组变量。这些变量定义了构建产物保存的位置和运行时数据加载的位置等信息。您可以添加自定义profile变量并在自己的构建脚本中使用。

Open the Profiles window (menu: Window > Asset Management > Addressables > Profiles) to edit profile values and create new profiles.

译:打开Profiles窗口(菜单:Window> Asset Management> Addressables> Profiles)以编辑profile值并创建新的profile。

The Addressables Profiles window showing the default profile.

You can set up different profiles for the different phases or tasks in your development process. For example, you could create one profile to use while developing your project, one to use for testing, and one to use for final publishing or release. Setting up the profiles in advance and swapping between them is much less error prone than editing the values individually when you move to a different phase or perform a different task.

译:您可以为开发过程中的不同阶段或任务设置不同的profile。例如,您可以创建一个profile用于开发项目,一个用于测试,一个用于最终发布或发布。提前设置profile并在它们之间切换比在移动到不同阶段或执行不同任务时单独编辑值要容错性更高。

Right-click a profile name to set it as the active profile, rename the profile, or delete it.

Addressables defines five profile variables by default:

译:右键单击profile名称可设置其为活动profile,重命名profile或删除profile。 Addressables默认定义了五个profile变量:

Local: defines two path variables for local content:译:Local:定义了本地内容的两个路径变量:

    • Local.BuildPath: where to build the files containing assets you want to install locally with your application. By default, this path is inside your Project Library folder.译:Local.BuildPath:要构建包含要在应用程序中本地安装的资产的文件的位置。默认情况下,此路径在您的Project Library文件夹内。

    • Local.LoadPath: where to load assets installed locally with your application. By default, this path is in the StreamingAssets folder. Addressables automatically includes local content built to the default location in StreamingAssets when you build a Player (but not from other locations).译:Local.LoadPath:要加载在应用程序中本地安装的资产的位置。默认情况下,此路径在StreamingAssets文件夹中。当您构建Player时,Addressables会自动将默认位置中构建的本地内容包含在StreamingAssets中(但不包括其他位置)。

  • Remote: defines two path variables for remote content:译:Remote:定义了远程内容的两个路径变量:

    • Remote.BuildPath: where to build the files containing assets you plan to distribute remotely.译:Remote.BuildPath:要构建包含要远程分发的资产的文件的位置。

    • Remote.LoadPath: the URL from which to download remote content and catalogs.译:Remote.LoadPath:下载远程内容和目录的URL。

  • BuildTarget: the name of the build target, such as Android or StandaloneWindows64译:BuildTarget:构建目标的名称,例如Android或StandaloneWindows64

You can choose the following pre-defined Bundle Locations for the Local and Remote path variables:译:您可以选择以下预定义的Bundle Locations用于Local和Remote路径变量:

  • Built-In: the path definitions for local content. The build system automatically includes content built with this setting in your Player builds. You should not change these path values.译:Built-In:本地内容的路径定义。构建系统会自动包含使用此设置构建的内容在您的Player构建中。您不应更改这些路径值。

  • Editor Hosted: the path definitions to use with the Editor [Hosting service]. Depending on how you set up the hosting service, you might need to edit the load path to match the service URL.译:Editor Hosted:与Editor [Hosting service]一起使用的路径定义。根据如何设置托管服务,您可能需要编辑加载路径以匹配服务URL。

  • Cloud Content Delivery: the path definitions for the Unity Cloud Content Delivery (CCD) service. Requires creating a Unity Project ID in the Services section of your Project settings (or linking to an existing ID). You must also install the CCD Management SDK package. See Addressable Asset system with Cloud Content Delivery for information about setting up and using the Cloud Content Delivey Bundle Location option.译:Cloud Content Delivery:Unity Cloud Content Delivery(CCD)服务的路径定义。需要在项目设置的服务部分创建Unity项目ID(或链接到现有ID)。您还必须安装CCD Management SDK软件包。有关设置和使用Cloud Content Delivery Bundle Location选项的信息,请参阅使用Cloud Content Delivery的Addressable Asset系统。

  • Custom: Allows you to edit the values used for the build and load paths. See Profile variable syntax for information about setting a variable value using placeholders that Addressables evaluates at build-time and runtime.译:Custom:允许您编辑用于构建和加载路径的值。有关使用Addressables在构建时和运行时评估占位符设置变量值的信息,请参阅Profile variable syntax。

WARNING

In most cases, you should not change the local build or load paths from their default values. If you do, you must manually 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.

译:在大多数情况下,您不应更改本地构建或加载路径的默认值。如果这样做,您必须在制作Player构建之前手动将本地构建产物从自定义构建位置复制到项目的StreamingAssets文件夹中。更改这些路径也会导致构建Addressables作为Player构建的一部分不可行。

See Builds for more information about how Addressables uses profiles during content builds.

译:有关Addressables在内容构建期间如何使用profiles的更多信息,请参见构建。

TIP

Using multiple profiles is most helpful when you distribute content for your application remotely. If you distribute all content as part of your application install, then the single, default profile might be the only profile you need.

译:在远程分发应用程序内容时,使用多个profiles最为有用。如果您将所有内容作为应用程序安装的一部分分发,则可能只需要单个默认profile。

Setting the active profile

The active profile determines the set of variables used when you run a build script.

译:活动profile决定了运行构建脚本时使用的变量集。

To set the active profile, either:

译:设置活动profile,可以:

  1. Open the Groups window (menu: Window > Asset Management > Addressables > Groups).译:打开Groups窗口(菜单:Window> Asset Management> Addressables> Groups)。

  2. Click the Profile menu in the toolbar.译:单击工具栏中的Profile菜单。

  3. Choose the profile to make active.译:选择要激活的profile。

Or:

  1. Open the Profiles window (menu: Window > Asset Management > Addressables > Profiles).译:打开Profiles窗口(菜单:Window> Asset Management> Addressables> Profiles)。

  2. Right- or cmd-click on a profile to open the context menu.译:右键或cmd单击一个profile以打开上下文菜单。

  3. Choose Set Active.译:选择Set Active。

NOTE

Build scripts include the Play Mode Scripts that Addressables invokes when you enter Play mode in the Editor. Some Play Mode scripts use variables from the active profile to locate content. See Play Mode Scripts for more information.

译:构建脚本包括Addressables在编辑器中进入播放模式时调用的Play Mode Scripts。一些Play Mode脚本使用来自活动profile的变量来定位内容。有关更多信息,请参见Play Mode Scripts。

Adding a new profile

To create a new profile, select Create > Profile. A new profile row appears in the table.

译:要创建新profile,请选择Create> Profile。表中会出现新的profile行。

Every profile must define a value for every variable. When you create a new profile, Addressables copies all values from the currently selected profile.

译:每个profile必须为每个变量定义一个值。创建新profile时,Addressables会从当前选定的profile复制所有值。

Profile variables

See [Profile Variables] for more information on how to use profile variables.

译:有关如何使用profile变量的更多信息,请参见Profile Variables。

Specifying packing and loading paths

Once you set up the necessary variables in your profile, you can select the build and load paths for an asset group based on those specified variables.

译:一旦在profile中设置了必要的变量,就可以基于那些指定的变量选择一个资产组的构建和加载路径。

To set your build and load paths:

译:要设置构建和加载路径:

  1. Select an Addressable Assets group from the Project window.译:从项目窗口中选择一个Addressable Assets组。

  2. In the group’s Inspector, under Content Packing & Loading > Build and Load Paths, select the desired path pair. If you choose the <custom> option, you can specify the build and load paths separately.译:在组的检查器下,选择Content Packing&Loading> Build and Load Paths,选择所需的路径对。如果选择选项,则可以单独指定构建和加载路径。

Notice that you do not enter the path directly, but rather select a variable representing the path defined in the Profiles window earlier. The Path Preview shows the current path, based on the active Profile. To edit a path directly in the Group settings Inspector, set Build & Load Paths to <custom> and also set the individual Build or Load Path to <custom>. The edited path applies to that group only.

译:请注意,您不直接输入路径,而是选择代表先前在Profiles窗口中定义的路径的变量。路径预览显示基于活动Profile的当前路径。要直接在Group设置检查器中编辑路径,请将Build&Load Paths设置为,并将个别Build或Load Path设置为。编辑的路径仅适用于该组。

Profile examples

Consider the following example, demonstrating the local development phase of your content.

译:考虑以下示例,演示内容的本地开发阶段。

Content with local and remote bundles stored locally for development.

译:本地和远程捆绑包存储在本地进行开发。

While in development, you would have both your local and remote bundles using local paths, as seen below.

译:在开发过程中,您将同时使用本地路径和远程路径来存储本地和远程捆绑包,如下所示。


Paths set for local development.

译:设置用于本地开发的路径。

In this instance, you can see that the local and remote paths are in fact local, which makes it unnecessary to set up a remote server just for local development.

译:在这种情况下,您可以看到本地和远程路径实际上是本地的,这使得为本地开发设置远程服务器变得不必要。

Once the content is ready for production, you would move the remote bundles to a server, as the diagram below shows.

译:一旦内容准备好进行生产,您将将远程捆绑包移动到服务器,如下图所示。

Content with the remote bundles moved to a server for production.

译:将远程捆绑包移动到服务器以用于生产的内容。

In this case, using profiles, you could change the remote load path for "Production" to that server. Without having to change your asset groups, you can change all of your remote bundles to actually become remote.

译:在这种情况下,使用profiles,您可以将“Production”的远程加载路径更改为该服务器。无需更改资产组,即可将所有远程捆绑包实际变为远程。

Paths set for hosting remote content

IMPORTANT

  • The Addressables system only copies data from Addressables.BuildPath to the StreamingAssets folder during a Player build -- it does not handle arbitrary paths specified through the LocalBuildPath or LocalLoadPath variables. If you build data to a different location or load data from a different location than the default, you must copy the data manually.译:Addressables系统仅在Player构建期间从Addressables.BuildPath复制数据到StreamingAssets文件夹 -- 它不处理通过LocalBuildPath或LocalLoadPath变量指定的任意路径。如果将数据构建到不同位置或从不同位置加载数据,则必须手动复制数据。

  • Similarly, you must manually upload remote AssetBundles and associated catalog and hash files to your server so that they can be accessed at the URL defined by RemoteLoadPath.译:同样,您必须手动上传远程AssetBundles以及关联的目录和哈希文件到您的服务器,以便它们可以在RemoteLoadPath定义的URL上访问。






Unity_Addressable_Profiles(配置文件)的评论 (共 条)

分享到微博请遵守国家法律