Class AddressableAssetGroup
Contains the collection of asset entries associated with this group.
Inherited Members
Namespace: UnityEditor.AddressableAssets.Settings
Syntax
[Serializable]
public class AddressableAssetGroup : ScriptableObject, IComparer<AddressableAssetEntry>, ISerializationCallbackReceiver
Properties
Default
Is the default group.
Declaration
public virtual bool Default { get; }
Property Value
Type | Description |
---|---|
Boolean |
entries
The collection of asset entries.
Declaration
public virtual ICollection<AddressableAssetEntry> entries { get; }
Property Value
Type | Description |
---|---|
ICollection<AddressableAssetEntry> |
Guid
The group GUID.
Declaration
public virtual string Guid { get; }
Property Value
Type | Description |
---|---|
String |
Name
The group name.
Declaration
public virtual string Name { get; set; }
Property Value
Type | Description |
---|---|
String |
ReadOnly
Is this group read only. This is normally false. Built in resources (resource folders and the scene list) are put into a special read only group.
Declaration
public virtual bool ReadOnly { get; }
Property Value
Type | Description |
---|---|
Boolean |
Schemas
List of schemas for this group.
Declaration
public List<AddressableAssetGroupSchema> Schemas { get; }
Property Value
Type | Description |
---|---|
List<AddressableAssetGroupSchema> |
SchemaTypes
Get the types of added schema for this group.
Declaration
public List<Type> SchemaTypes { get; }
Property Value
Type | Description |
---|---|
List<Type> |
Settings
The AddressableAssetSettings that this group belongs to.
Declaration
public AddressableAssetSettings Settings { get; }
Property Value
Type | Description |
---|---|
AddressableAssetSettings |
Methods
AddSchema(Type, Boolean)
Creates and adds a schema of a given type to this group. The schema asset will be created in the GroupSchemas directory relative to the settings asset.
Declaration
public AddressableAssetGroupSchema AddSchema(Type type, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The schema type. This type must not already be added. |
Boolean | postEvent | Determines if this method call will post an event to the internal addressables event system |
Returns
Type | Description |
---|---|
AddressableAssetGroupSchema | The created schema object. |
AddSchema(AddressableAssetGroupSchema, Boolean)
Adds a copy of the provided schema object.
Declaration
public AddressableAssetGroupSchema AddSchema(AddressableAssetGroupSchema schema, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetGroupSchema | schema | The schema to add. A copy will be made and saved in a folder relative to the main Addressables settings asset. |
Boolean | postEvent | Determines if this method call will post an event to the internal addressables event system |
Returns
Type | Description |
---|---|
AddressableAssetGroupSchema | The created schema object. |
AddSchema<TSchema>(Boolean)
Creates and adds a schema of a given type to this group.
Declaration
public TSchema AddSchema<TSchema>(bool postEvent = true)
where TSchema : AddressableAssetGroupSchema
Parameters
Type | Name | Description |
---|---|---|
Boolean | postEvent | Determines if this method call will post an event to the internal addressables event system |
Returns
Type | Description |
---|---|
TSchema | The created schema object. |
Type Parameters
Name | Description |
---|---|
TSchema | The schema type. This type must not already be added. |
CanBeSetAsDefault()
Check if a group has the appropriate schemas and attributes that the Default Group requires.
Declaration
public bool CanBeSetAsDefault()
Returns
Type | Description |
---|---|
Boolean |
ClearSchemas(Boolean, Boolean)
Removes all schemas and optionally deletes the assets associated with them.
Declaration
public void ClearSchemas(bool deleteAssets, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | deleteAssets | If true, the schema assets will also be deleted. |
Boolean | postEvent | Determines if this method call will post an event to the internal addressables event system |
Compare(AddressableAssetEntry, AddressableAssetEntry)
Declaration
public virtual int Compare(AddressableAssetEntry x, AddressableAssetEntry y)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetEntry | x | |
AddressableAssetEntry | y |
Returns
Type | Description |
---|---|
Int32 |
Implements
FindSchema(Type)
Gets the index of a schema based on its specified type.
Declaration
public int FindSchema(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The schema type. |
Returns
Type | Description |
---|---|
Int32 | Valid index if found, otherwise returns -1. |
GatherAllAssets(List<AddressableAssetEntry>, Boolean, Boolean, Boolean, Func<AddressableAssetEntry, Boolean>)
Gathers all asset entries. Each explicit entry may contain multiple sub entries. For example, addressable folders create entries for each asset contained within.
Declaration
public virtual void GatherAllAssets(List<AddressableAssetEntry> results, bool includeSelf, bool recurseAll, bool includeSubObjects, Func<AddressableAssetEntry, bool> entryFilter = null)
Parameters
Type | Name | Description |
---|---|---|
List<AddressableAssetEntry> | results | The generated list of entries. For simple entries, this will contain just the entry itself if specified. |
Boolean | includeSelf | Determines if the entry should be contained in the result list or just sub entries. |
Boolean | recurseAll | Determines if full recursion should be done when gathering entries. |
Boolean | includeSubObjects | Determines if sub objects such as sprites should be included. |
Func<AddressableAssetEntry, Boolean> | entryFilter | Optional predicate to run against each entry, only returning those that pass. A null filter will return all entries |
GetAssetEntry(String)
Get an entry via the asset guid.
Declaration
public virtual AddressableAssetEntry GetAssetEntry(string guid)
Parameters
Type | Name | Description |
---|---|---|
String | guid | The asset guid. |
Returns
Type | Description |
---|---|
AddressableAssetEntry |
GetSchema(Type)
Gets an added schema of the specified type.
Declaration
public AddressableAssetGroupSchema GetSchema(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The schema type. |
Returns
Type | Description |
---|---|
AddressableAssetGroupSchema | The schema if found, otherwise null. |
GetSchema<TSchema>()
Gets an added schema of the specified type.
Declaration
public TSchema GetSchema<TSchema>()
where TSchema : AddressableAssetGroupSchema
Returns
Type | Description |
---|---|
TSchema | The schema if found, otherwise null. |
Type Parameters
Name | Description |
---|---|
TSchema | The schema type. |
HasSchema(Type)
Checks if the group contains a schema of a given type.
Declaration
public bool HasSchema(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The schema type. |
Returns
Type | Description |
---|---|
Boolean | True if the schema type or subclass has been added to this group. |
HasSchema<TSchema>()
Checks if the group contains a schema of a given type.
Declaration
public bool HasSchema<TSchema>()
Returns
Type | Description |
---|---|
Boolean | True if the schema type or subclass has been added to this group. |
Type Parameters
Name | Description |
---|---|
TSchema | The schema type. |
IsDefaultGroup()
Check to see if a group is the Default Group.
Declaration
public bool IsDefaultGroup()
Returns
Type | Description |
---|---|
Boolean |
OnAfterDeserialize()
Converts data from serializable format.
Declaration
public void OnAfterDeserialize()
Implements
OnBeforeSerialize()
Converts data to serializable format.
Declaration
public void OnBeforeSerialize()
Implements
RemoveAssetEntry(AddressableAssetEntry, Boolean)
Remove an entry.
Declaration
public void RemoveAssetEntry(AddressableAssetEntry entry, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetEntry | entry | The entry to remove. |
Boolean | postEvent | If true, post the event to callbacks. |
RemoveSchema(Type, Boolean)
Remove a given schema from this group.
Declaration
public bool RemoveSchema(Type type, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The schema type. |
Boolean | postEvent | Determines if this method call will post an event to the internal addressables event system |
Returns
Type | Description |
---|---|
Boolean | True if the schema was found and removed, false otherwise. |
RemoveSchema<TSchema>(Boolean)
Remove a given schema from this group.
Declaration
public bool RemoveSchema<TSchema>(bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | postEvent | Determines if this method call will post an event to the internal addressables event system |
Returns
Type | Description |
---|---|
Boolean | True if the schema was found and removed, false otherwise. |
Type Parameters
Name | Description |
---|---|
TSchema | The schema type. |
SetDirty(AddressableAssetSettings.ModificationEvent, Object, Boolean, Boolean)
Marks the object as modified.
Declaration
public void SetDirty(AddressableAssetSettings.ModificationEvent modificationEvent, object eventData, bool postEvent, bool groupModified = 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 | groupModified | If true, the group asset will be marked as dirty. |