您当前的位置:首页 >  快讯  > 正文
Unity_Addressable_Labels(标签)
来源:哔哩哔哩     时间:2023-03-31 09:03:12

You can tag your Addressable assets with one or more labels in the Groups window. Labels have a few uses in the Addressables system, including:


(资料图片仅供参考)

译:您可以在Groups窗口中为Addressable资产打上一个或多个标签。标签在Addressables系统中有几个用途,包括:

You can use one or more labels as keys to identify which assets to load at runtime.译:您可以使用一个或多个标签作为键来标识需要在运行时加载的资产。

You can pack assets in a group into AssetBundles based on their assigned labels.译:您可以根据其分配的标签将资产打包到一个组中的AssetBundles中。

You can use labels in the filter box of the Groups window to help find labeled assets译:您可以在Groups窗口的筛选框中使用标签来帮助查找带有标签的资产。

When you load assets using a list of labels, you can specify whether you want to load all assets having any label in the list or only assets that have every label in the list. For example, if you used the labels, "characters" and "animals" to load assets, you could choose to load the union of those two sets of assets, which includes all characters and all animals, or the intersection of those two sets, which includes only characters that are animals. See Loading multiple assets for more information.

译:当您使用标签列表加载资产时,您可以指定是否要加载列表中具有任何标签的所有资产,还是仅加载列表中每个标签都具有的资产。例如,如果您使用“characters”和“animals”标签来加载资产,则可以选择加载这两组资产的并集,其中包括所有角色和所有动物,或者这两组资产的交集,其中仅包括动物角色。有关更多信息,请参见加载多个资产。

When you choose to pack assets in a group based on their assigned labels (using the group Bundle Mode setting), the Addressables build script creates a bundle for each unique combination of labels in the group. For example, if you have assets in a group that you have labeled as either "cat" or "dog" and either "small" or "large", the build produces four bundles: one for small cats, one for small dogs, one for large cats, and another for large dogs.

译:当您选择根据其分配的标签(使用组Bundle Mode设置)将资产打包到组中时,Addressables构建脚本会为组中每个唯一标签组合创建一个bundle。例如,如果您在组中有标记为“cat”或“dog”以及“small”或“large”的资产,则构建将产生四个bundle:一个用于小猫,一个用于小狗,一个用于大猫,另一个用于大狗。

Managing labels

Create and delete labels on the Labels window. Open the Labelswindow from the Toolsmenu on the Groupswindow toolbar.

译:在Labels窗口上创建和删除标签。从Groups窗口工具栏上的Tools菜单打开Labels窗口。

To create a new label, click the +button at the bottom of the list. Enter the new name and click Save.

译:要创建新标签,请单击列表底部的+按钮。输入新名称,然后单击Save。

To delete a label, select it in the list and then click the -button. Deleting a label also removes it from all assets.

译:要删除标签,请在列表中选择它,然后单击-按钮。删除标签也会将其从所有资产中删除。

TIP

Until you run an Addressables build, you can undo the deletion of a label by adding it back to the Labels dialog (using the exact same string). This also adds the label back to its original assets. After you run an Addressables build, however, re-adding a deleted label no longer reapplies it to any assets.

译:在运行Addressables构建之前,您可以通过将其添加回Labels对话框(使用完全相同的字符串)来撤消对标签的删除。这也会将标签添加回其原始资产。但是,在运行Addressables构建之后,重新添加已删除的标签将不再应用于任何资产。

标签:

相关新闻

X 关闭

X 关闭

精彩推荐