Class AddressableAssetSettings
Contains editor data for the addressables system.
Namespace: UnityEditor.AddressableAssets.Settings
Syntax
public class AddressableAssetSettings : ScriptableObject
Fields
kLocalBuildPath
Default name of local build path.
Declaration
public const string kLocalBuildPath = "LocalBuildPath"
Field Value
Type | Description |
---|---|
String |
kLocalLoadPath
Default name of local load path.
Declaration
public const string kLocalLoadPath = "LocalLoadPath"
Field Value
Type | Description |
---|---|
String |
kNewGroupName
Default name of a newly created group.
Declaration
public const string kNewGroupName = "New Group"
Field Value
Type | Description |
---|---|
String |
kRemoteBuildPath
Default name of remote build path.
Declaration
public const string kRemoteBuildPath = "RemoteBuildPath"
Field Value
Type | Description |
---|---|
String |
kRemoteLoadPath
Default name of remote load path.
Declaration
public const string kRemoteLoadPath = "RemoteLoadPath"
Field Value
Type | Description |
---|---|
String |
Properties
ActivePlayerDataBuilder
Get the active data builder for player data.
Declaration
public IDataBuilder ActivePlayerDataBuilder { get; }
Property Value
Type | Description |
---|---|
IDataBuilder |
ActivePlayerDataBuilderIndex
Get the index of the active player data builder.
Declaration
public int ActivePlayerDataBuilderIndex { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
ActivePlayModeDataBuilder
Get the active data builder for editor play mode data.
Declaration
public IDataBuilder ActivePlayModeDataBuilder { get; }
Property Value
Type | Description |
---|---|
IDataBuilder |
ActivePlayModeDataBuilderIndex
Get the index of the active play mode data builder.
Declaration
public int ActivePlayModeDataBuilderIndex { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
activeProfileId
The active profile id.
Declaration
public string activeProfileId { get; set; }
Property Value
Type | Description |
---|---|
String |
AssetPath
The path of the settings asset.
Declaration
public string AssetPath { get; }
Property Value
Type | Description |
---|---|
String |
BuildRemoteCatalog
Determine if a remote catalog should be built-for and loaded-by the app.
Declaration
public bool BuildRemoteCatalog { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
buildSettings
Build settings object.
Declaration
public AddressableAssetBuildSettings buildSettings { get; }
Property Value
Type | Description |
---|---|
AddressableAssetBuildSettings |
BundleLocalCatalog
Whether the local catalog should be serialized in an asset bundle or as json.
Declaration
public bool BundleLocalCatalog { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
CertificateHandlerType
The type of CertificateHandler to use for this provider.
Declaration
public Type CertificateHandlerType { get; set; }
Property Value
Type | Description |
---|---|
Type |
ConfigFolder
The folder of the settings asset.
Declaration
public string ConfigFolder { get; }
Property Value
Type | Description |
---|---|
String |
currentHash
Hash of the current settings. This value is recomputed if anything changes.
Declaration
public Hash128 currentHash { get; }
Property Value
Type | Description |
---|---|
Hash128 |
DataBuilderFolder
The folder for the script assets.
Declaration
public string DataBuilderFolder { get; }
Property Value
Type | Description |
---|---|
String |
DataBuilders
List of ScriptableObjects that implement the IDataBuilder interface. These are used to create data for editor play mode and for player builds.
Declaration
public List<ScriptableObject> DataBuilders { get; }
Property Value
Type | Description |
---|---|
List<ScriptableObject> |
DefaultGroup
The default group. This group is used when marking assets as addressable via the inspector.
Declaration
public AddressableAssetGroup DefaultGroup { get; set; }
Property Value
Type | Description |
---|---|
AddressableAssetGroup |
DisableCatalogUpdateOnStartup
Tells Addressables if it should check for a Content Catalog Update during the initialization step.
Declaration
public bool DisableCatalogUpdateOnStartup { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
GroupFolder
The folder for the group assets.
Declaration
public string GroupFolder { get; }
Property Value
Type | Description |
---|---|
String |
groups
List of asset groups.
Declaration
public List<AddressableAssetGroup> groups { get; }
Property Value
Type | Description |
---|---|
List<AddressableAssetGroup> |
GroupSchemaFolder
The folder for the asset group schema assets.
Declaration
public string GroupSchemaFolder { get; }
Property Value
Type | Description |
---|---|
String |
GroupTemplateFolder
The default folder for the group template assets.
Declaration
public string GroupTemplateFolder { get; }
Property Value
Type | Description |
---|---|
String |
GroupTemplateObjects
List of ScriptableObjects that implement the IGroupTemplate interface for providing new templates. For use in the AddressableAssetsWindow to display new groups to create
Declaration
public List<ScriptableObject> GroupTemplateObjects { get; }
Property Value
Type | Description |
---|---|
List<ScriptableObject> |
HostingServicesManager
Get the HostingServicesManager object.
Declaration
public HostingServicesManager HostingServicesManager { get; }
Property Value
Type | Description |
---|---|
HostingServicesManager |
InitializationObjects
List of ScriptableObjects that implement the IObjectInitializationDataProvider interface for providing runtime initialization.
Declaration
public List<ScriptableObject> InitializationObjects { get; }
Property Value
Type | Description |
---|---|
List<ScriptableObject> |
IsPersisted
Returns whether this settings object is persisted to an asset.
Declaration
public bool IsPersisted { get; }
Property Value
Type | Description |
---|---|
Boolean |
OnDataBuilderComplete
Event for handling the result of a DataBuilder.Build call.
Declaration
public Action<AddressableAssetSettings, IDataBuilder, IDataBuilderResult> OnDataBuilderComplete { get; set; }
Property Value
Type | Description |
---|---|
Action<AddressableAssetSettings, IDataBuilder, IDataBuilderResult> |
OnModification
Event for handling settings changes. The object passed depends on the event type.
Declaration
public Action<AddressableAssetSettings, AddressableAssetSettings.ModificationEvent, object> OnModification { get; set; }
Property Value
Type | Description |
---|---|
Action<AddressableAssetSettings, AddressableAssetSettings.ModificationEvent, Object> |
OverridePlayerVersion
Allows for overriding the player version used to generated catalog names.
Declaration
public string OverridePlayerVersion { get; set; }
Property Value
Type | Description |
---|---|
String |
PlayerBuildVersion
The version of the player build. This is implemented as a timestamp int UTC of the form string.Format("{0:D4}.{1:D2}.{2:D2}.{3:D2}.{4:D2}.{5:D2}", now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second).
Declaration
public string PlayerBuildVersion { get; }
Property Value
Type | Description |
---|---|
String |
profileSettings
Profile settings object.
Declaration
public AddressableAssetProfileSettings profileSettings { get; }
Property Value
Type | Description |
---|---|
AddressableAssetProfileSettings |
RemoteCatalogBuildPath
The path to place a copy of the content catalog for online retrieval. To do any content updates to an existing built app, there must be a remote catalog. Overwriting the catalog is how the app gets informed of the updated content.
Declaration
public ProfileValueReference RemoteCatalogBuildPath { get; set; }
Property Value
Type | Description |
---|---|
ProfileValueReference |
RemoteCatalogLoadPath
The path to load the remote content catalog from. This is the location the app will check to look for updated catalogs, which is the only indication the app has for updated content.
Declaration
public ProfileValueReference RemoteCatalogLoadPath { get; set; }
Property Value
Type | Description |
---|---|
ProfileValueReference |
UniqueBundleIds
Declaration
public bool UniqueBundleIds { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
AddDataBuilder(IDataBuilder, Boolean)
Adds a data builder.
Declaration
public bool AddDataBuilder(IDataBuilder builder, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
IDataBuilder | builder | The data builder to add. |
Boolean | postEvent | Indicates if an even should be posted to the Addressables event system for this change. |
Returns
Type | Description |
---|---|
Boolean | True if the data builder was added. |
AddGroupTemplateObject(IGroupTemplate, Boolean)
Adds a AddressableAssetsGroupTemplate object.
Declaration
public bool AddGroupTemplateObject(IGroupTemplate templateObject, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
IGroupTemplate | templateObject | The AddressableAssetGroupTemplate object to add. |
Boolean | postEvent | Indicates if an even should be posted to the Addressables event system for this change. |
Returns
Type | Description |
---|---|
Boolean | True if the initialization object was added. |
AddInitializationObject(IObjectInitializationDataProvider, Boolean)
Adds an initialization object.
Declaration
public bool AddInitializationObject(IObjectInitializationDataProvider initObject, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
IObjectInitializationDataProvider | initObject | The initialization object to add. |
Boolean | postEvent | Indicates if an even should be posted to the Addressables event system for this change. |
Returns
Type | Description |
---|---|
Boolean | True if the initialization object was added. |
AddLabel(String, Boolean)
Add a new label.
Declaration
public void AddLabel(string label, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
String | label | The label name. |
Boolean | postEvent | Send modification event. |
BuildPlayerContent()
Runs the active player data build script to create runtime data.
Declaration
public static void BuildPlayerContent()
CleanPlayerContent(IDataBuilder)
Deletes all created runtime data for the active player data builder.
Declaration
public static void CleanPlayerContent(IDataBuilder builder = null)
Parameters
Type | Name | Description |
---|---|---|
IDataBuilder | builder | The builder to call ClearCachedData on. If null, all builders will be cleaned |
Create(String, String, Boolean, Boolean)
Create a new AddressableAssetSettings object.
Declaration
public static AddressableAssetSettings Create(string configFolder, string configName, bool createDefaultGroups, bool isPersisted)
Parameters
Type | Name | Description |
---|---|---|
String | configFolder | The folder to store the settings object. |
String | configName | The name of the settings object. |
Boolean | createDefaultGroups | If true, create groups for player data and local packed content. |
Boolean | isPersisted | If true, assets are created. |
Returns
Type | Description |
---|---|
AddressableAssetSettings |
CreateAndAddGroupTemplate(String, String, Type[])
Creates a new AddressableAssetGroupTemplate Object with the set of schema types with default settings for use in the editor GUI.
Declaration
public bool CreateAndAddGroupTemplate(string displayName, string description, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
String | displayName | The display name of the template. |
String | description | Description text use with the template. |
Type[] | types | The schema types for the template. |
Returns
Type | Description |
---|---|
Boolean | True if the template was added, false otherwise. |
CreateAssetReference(String)
Create an AssetReference object. If the asset is not already addressable, it will be added.
Declaration
public AssetReference CreateAssetReference(string guid)
Parameters
Type | Name | Description |
---|---|---|
String | guid | The guid of the asset reference. |
Returns
Type | Description |
---|---|
AssetReference | Returns the newly created AssetReference. |
CreateGroup(String, Boolean, Boolean, Boolean, List<AddressableAssetGroupSchema>, Type[])
Create a new asset group.
Declaration
public AddressableAssetGroup CreateGroup(string groupName, bool setAsDefaultGroup, bool readOnly, bool postEvent, List<AddressableAssetGroupSchema> schemasToCopy, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
String | groupName | The group name. |
Boolean | setAsDefaultGroup | Set the new group as the default group. |
Boolean | readOnly | Is the new group read only. |
Boolean | postEvent | Post modification event. |
List<AddressableAssetGroupSchema> | schemasToCopy | Schema set to copy from. |
Type[] | types | Types of schemas to add. |
Returns
Type | Description |
---|---|
AddressableAssetGroup | The newly created group. |
CreateOrMoveEntry(String, AddressableAssetGroup, Boolean, Boolean)
Create a new entry, or if one exists in a different group, move it into the new group.
Declaration
public AddressableAssetEntry CreateOrMoveEntry(string guid, AddressableAssetGroup targetParent, bool readOnly = false, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
String | guid | The asset guid. |
AddressableAssetGroup | targetParent | The group to add the entry to. |
Boolean | readOnly | Is the new entry read only. |
Boolean | postEvent | Send modification event. |
Returns
Type | Description |
---|---|
AddressableAssetEntry |
FindAssetEntry(String)
Find and asset entry by guid.
Declaration
public AddressableAssetEntry FindAssetEntry(string guid)
Parameters
Type | Name | Description |
---|---|---|
String | guid | The asset guid. |
Returns
Type | Description |
---|---|
AddressableAssetEntry | The found entry or null. |
FindGroup(Func<AddressableAssetGroup, Boolean>)
Find asset group by functor.
Declaration
public AddressableAssetGroup FindGroup(Func<AddressableAssetGroup, bool> func)
Parameters
Type | Name | Description |
---|---|---|
Func<AddressableAssetGroup, Boolean> | func | The functor to call on each group. The first group that evaluates to true is returned. |
Returns
Type | Description |
---|---|
AddressableAssetGroup | The group found or null. |
FindGroup(String)
Find asset group by name.
Declaration
public AddressableAssetGroup FindGroup(string groupName)
Parameters
Type | Name | Description |
---|---|---|
String | groupName | The name of the group. |
Returns
Type | Description |
---|---|
AddressableAssetGroup | The group found or null. |
GetAllAssets(List<AddressableAssetEntry>, Boolean, Func<AddressableAssetGroup, Boolean>, Func<AddressableAssetEntry, Boolean>)
Gets all asset entries from all groups.
Declaration
public void GetAllAssets(List<AddressableAssetEntry> assets, bool includeSubObjects, Func<AddressableAssetGroup, bool> groupFilter = null, Func<AddressableAssetEntry, bool> entryFilter = null)
Parameters
Type | Name | Description |
---|---|---|
List<AddressableAssetEntry> | assets | The list of asset entries. |
Boolean | includeSubObjects | Determines if sub objects such as sprites should be included. |
Func<AddressableAssetGroup, Boolean> | groupFilter | A method to filter groups. Groups will be processed if filter is null, or it returns TRUE |
Func<AddressableAssetEntry, Boolean> | entryFilter | A method to filter entries. Entries will be processed if filter is null, or it returns TRUE |
GetDataBuilder(Int32)
Get The data builder at a specifc index.
Declaration
public IDataBuilder GetDataBuilder(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the builder. |
Returns
Type | Description |
---|---|
IDataBuilder | The data builder at the specified index. |
GetGroupTemplateObject(Int32)
Get the IGroupTemplate at the specified index.
Declaration
public IGroupTemplate GetGroupTemplateObject(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the template object. |
Returns
Type | Description |
---|---|
IGroupTemplate | The AddressableAssetGroupTemplate object at the specified index. |
GetInitializationObject(Int32)
Get the IObjectInitializationDataProvider at a specifc index.
Declaration
public IObjectInitializationDataProvider GetInitializationObject(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index of the initialization object. |
Returns
Type | Description |
---|---|
IObjectInitializationDataProvider | The initialization object at the specified index. |
GetLabels()
Gets the list of all defined labels.
Declaration
public List<string> GetLabels()
Returns
Type | Description |
---|---|
List<String> |
MoveEntries(List<AddressableAssetEntry>, AddressableAssetGroup, Boolean, Boolean)
Move an existing entry to a group.
Declaration
public void MoveEntries(List<AddressableAssetEntry> entries, AddressableAssetGroup targetParent, bool readOnly = false, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
List<AddressableAssetEntry> | entries | The entries to move. |
AddressableAssetGroup | targetParent | The group to add the entries to. |
Boolean | readOnly | Should the entries be read only. |
Boolean | postEvent | Send modification event. |
MoveEntry(AddressableAssetEntry, AddressableAssetGroup, Boolean, Boolean)
Move an existing entry to a group.
Declaration
public void MoveEntry(AddressableAssetEntry entry, AddressableAssetGroup targetParent, bool readOnly = false, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetEntry | entry | The entry to move. |
AddressableAssetGroup | targetParent | The group to add the entry to. |
Boolean | readOnly | Should the entry be read only. |
Boolean | postEvent | Send modification event. |
RemoveAssetEntry(String, Boolean)
Remove an asset entry.
Declaration
public bool RemoveAssetEntry(string guid, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
String | guid | The guid of the asset. |
Boolean | postEvent | Send modifcation event. |
Returns
Type | Description |
---|---|
Boolean | True if the entry was found and removed. |
RemoveDataBuilder(Int32, Boolean)
Remove the data builder at the sprcified index.
Declaration
public bool RemoveDataBuilder(int index, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index to remove. |
Boolean | postEvent | Indicates if an even should be posted to the Addressables event system for this change. |
Returns
Type | Description |
---|---|
Boolean | True if the builder was removed. |
RemoveGroup(AddressableAssetGroup)
Remove an asset group.
Declaration
public void RemoveGroup(AddressableAssetGroup g)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetGroup | g |
RemoveGroupTemplateObject(Int32, Boolean)
Remove the AddressableAssetGroupTemplate object at the specified index.
Declaration
public bool RemoveGroupTemplateObject(int index, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index to remove. |
Boolean | postEvent | Indicates if an event should be posted to the Addressables event system for this change. |
Returns
Type | Description |
---|---|
Boolean | True if the initialization object was removed. |
RemoveInitializationObject(Int32, Boolean)
Remove the initialization object at the specified index.
Declaration
public bool RemoveInitializationObject(int index, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index to remove. |
Boolean | postEvent | Indicates if an even should be posted to the Addressables event system for this change. |
Returns
Type | Description |
---|---|
Boolean | True if the initialization object was removed. |
RemoveLabel(String, Boolean)
Remove a label by name.
Declaration
public void RemoveLabel(string label, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
String | label | The label name. |
Boolean | postEvent | Send modification event. |
RemoveSchemaTemplate(Int32, Boolean)
Remove the schema at the specified index.
Declaration
public bool RemoveSchemaTemplate(int index, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index to remove at. |
Boolean | postEvent | Indicates if an even should be posted to the Addressables event system for this change. |
Returns
Type | Description |
---|---|
Boolean | True if the schema was removed. |
SetDataBuilderAtIndex(Int32, IDataBuilder, Boolean)
Sets the data builder at the specified index.
Declaration
public bool SetDataBuilderAtIndex(int index, IDataBuilder builder, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index to set the builder. |
IDataBuilder | builder | The builder to set. This must be a valid scriptable object that implements the IDataBuilder interface. |
Boolean | postEvent | Indicates if an even should be posted to the Addressables event system for this change. |
Returns
Type | Description |
---|---|
Boolean | True if the builder was set, false otherwise. |
SetDirty(AddressableAssetSettings.ModificationEvent, Object, Boolean, Boolean)
Marks the object as modified.
Declaration
public void SetDirty(AddressableAssetSettings.ModificationEvent modificationEvent, object eventData, bool postEvent, bool settingsModified = false)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetSettings.ModificationEvent | modificationEvent | The event type that is changed. |
Object | eventData | The object data that corresponds to the event. |
Boolean | postEvent | If true, the event is propagated to callbacks. |
Boolean | settingsModified | If true, the settings asset will be marked as dirty. |
SetGroupTemplateObjectAtIndex(Int32, IGroupTemplate, Boolean)
Sets the initialization object at the specified index.
Declaration
public bool SetGroupTemplateObjectAtIndex(int index, IGroupTemplate templateObject, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index to set the initialization object. |
IGroupTemplate | templateObject | The rroup template object to set. This must be a valid scriptable object that implements the IGroupTemplate interface. |
Boolean | postEvent | Indicates if an even should be posted to the Addressables event system for this change. |
Returns
Type | Description |
---|---|
Boolean | True if the initialization object was set, false otherwise. |
SetInitializationObjectAtIndex(Int32, IObjectInitializationDataProvider, Boolean)
Sets the initialization object at the specified index.
Declaration
public bool SetInitializationObjectAtIndex(int index, IObjectInitializationDataProvider initObject, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The index to set the initialization object. |
IObjectInitializationDataProvider | initObject | The initialization object to set. This must be a valid scriptable object that implements the IInitializationObject interface. |
Boolean | postEvent | Indicates if an even should be posted to the Addressables event system for this change. |
Returns
Type | Description |
---|---|
Boolean | True if the initialization object was set, false otherwise. |
Events
OnModificationGlobal
Event for handling settings changes on all instances of AddressableAssetSettings. The object passed depends on the event type.
Declaration
public static event Action<AddressableAssetSettings, AddressableAssetSettings.ModificationEvent, object> OnModificationGlobal
Event Type
Type | Description |
---|---|
Action<AddressableAssetSettings, AddressableAssetSettings.ModificationEvent, Object> |