Class AddressableAssetGroup
Contains the collection of asset entries associated with this group.
Inheritance
Namespace: UnityEditor.AddressableAssets
Syntax
public class AddressableAssetGroup : ScriptableObject, IComparer<AddressableAssetEntry>, ISerializationCallbackReceiver
Properties
Default
Is the default group.
Declaration
public virtual bool Default { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
entries
The collection of asset entries.
Declaration
public virtual ICollection<AddressableAssetEntry> entries { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<AddressableAssetEntry> |
Guid
The group GUID.
Declaration
public virtual string Guid { get; }
Property Value
Type | Description |
---|---|
System.String |
Name
The group name.
Declaration
public virtual string Name { get; set; }
Property Value
Type | Description |
---|---|
System.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 |
---|---|
System.Boolean |
Schemas
List of schemas for this group.
Declaration
public List<AddressableAssetGroupSchema> Schemas { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<AddressableAssetGroupSchema> |
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. |
System.Boolean | postEvent |
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. |
System.Boolean | postEvent |
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 |
---|---|---|
System.Boolean | postEvent |
Returns
Type | Description |
---|---|
TSchema | The created schema object. |
Type Parameters
Name | Description |
---|---|
TSchema | The schema type. This type must not already be added. |
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 |
---|---|---|
System.Boolean | deleteAssets | If true, the schema assets will also be deleted. |
System.Boolean | postEvent |
Compare(AddressableAssetEntry, AddressableAssetEntry)
Declaration
public virtual int Compare(AddressableAssetEntry x, AddressableAssetEntry y)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetEntry | x | |
AddressableAssetEntry | y |
Returns
Type | Description |
---|---|
System.Int32 |
Implements
GatherAllAssets(List<AddressableAssetEntry>, Boolean, 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)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<AddressableAssetEntry> | results | The generated list of entries. For simple entries, this will contain just the entry itself if specified. |
System.Boolean | includeSelf | Determines if the entry should be contained in the result list or just sub entries. |
System.Boolean | recurseAll | Determines if full recursion should be done when gathering entries. |
GetAssetEntry(String)
Get an entry via the asset guid.
Declaration
public virtual AddressableAssetEntry GetAssetEntry(string guid)
Parameters
Type | Name | Description |
---|---|---|
System.String | guid | The asset guid. |
Returns
Type | Description |
---|---|
AddressableAssetEntry |
GetSchema(Type)
Declaration
public AddressableAssetGroupSchema GetSchema(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type |
Returns
Type | Description |
---|---|
AddressableAssetGroupSchema |
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)
Declaration
public bool HasSchema(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type |
Returns
Type | Description |
---|---|
System.Boolean |
HasSchema<TSchema>()
Checks if the group contains a schema of a given type.
Declaration
public bool HasSchema<TSchema>()
Returns
Type | Description |
---|---|
System.Boolean | True if the schema type or subclass has been added to this group. |
Type Parameters
Name | Description |
---|---|
TSchema | The schema type. |
OnAfterDeserialize()
Converts data from serializable format.
Declaration
public void OnAfterDeserialize()
OnBeforeSerialize()
Converts data to serializable format.
Declaration
public void OnBeforeSerialize()
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. |
System.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. |
System.Boolean | postEvent |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.Boolean | postEvent |
Returns
Type | Description |
---|---|
System.Boolean | True if the schema was found and removed, false otherwise. |
Type Parameters
Name | Description |
---|---|
TSchema | The schema type. |
SetDirty(AddressableAssetSettings.ModificationEvent, Object, Boolean)
Marks the object as modified.
Declaration
public void SetDirty(AddressableAssetSettings.ModificationEvent modificationEvent, object eventData, bool postEvent)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetSettings.ModificationEvent | modificationEvent | The event type that is changed. |
System.Object | eventData | The object data that corresponds to the event. |
System.Boolean | postEvent | If true, the event is propagated to callbacks. |