WuhuIslandTesting/Library/PackageCache/com.unity.addressables@1.21.12/Documentation~/editor/groups/GroupSchemas.md
2025-01-07 02:06:59 +01:00

5.1 KiB

uid
addressables-group-schemas

Group Settings

Group settings determine how Unity treats the assets in a group in content builds. Group settings control properties such as the location where AssetBundles are built or bundle compression settings.

A group's settings are declared in Schema objects attached to the group. When you create a group with the Packed Assets template, the Content Packing & Loading and Content Update Restriction schemas define the settings for the group. The default Build scripts expect these settings.


The Inspector window for the Default Local Group

Note

If you create a group with the Blank template, then no schemas are attached to the group. Assets in such a group cannot be processed by the default build scripts.

Schemas

A group schema is a ScriptableObject that defines a collection of settings for an Addressables group. You can assign any number of schemas to a group. The Addressables system defines a number of schemas for its own purposes. You can also create custom schemas to support your own build scripts and utilities.

The built-in schemas include:

  • Content Packing & Loading: this is the main Addressables schema used by the default build script and defines the settings for building and loading Addressable assets.
  • Content Update Restrictions: defines settings for making differential updates of a previous build. See Builds for more information about update builds.
  • Resources and Built In Scenes: a special-purpose schema defining settings for which types of built-in assets to display in the Built In Data group.

Defining custom schemas

To create your own schema, extend the AddressableAssetGroupSchema class (which is a kind of ScriptableObject).

using UnityEditor.AddressableAssets.Settings;

public class __CustomSchema __: AddressableAssetGroupSchema
{
   public string CustomDescription;
}

Once you have defined your custom schema object, you can add it to existing groups and group templates using the Add Schema buttons found on the Inspector windows of those entities.

You might also want to create a custom Editor script to help users interact with your custom settings. See Custom Inspector scripts.

In a build script, you can access the schema settings for a group using its AddressableAssetGroup object.