Class AddressableAssetEntry
Contains data for an addressable asset entry.
Inherited Members
Namespace: UnityEditor.AddressableAssets.Settings
Syntax
[Serializable]
public class AddressableAssetEntry : ISerializationCallbackReceiver
Properties
address
The address of the entry. This is treated as the primary key in the ResourceManager system.
Declaration
public string address { get; set; }
Property Value
Type | Description |
---|---|
String |
AssetPath
The path of the asset.
Declaration
public string AssetPath { get; }
Property Value
Type | Description |
---|---|
String |
BundleFileId
The id for the bundle file.
Declaration
public string BundleFileId { get; set; }
Property Value
Type | Description |
---|---|
String |
guid
The asset guid.
Declaration
public string guid { get; }
Property Value
Type | Description |
---|---|
String |
IsInResources
Is the asset in a resource folder.
Declaration
public bool IsInResources { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsInSceneList
Is scene in scene list.
Declaration
public bool IsInSceneList { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsScene
Is this entry for a scene.
Declaration
public bool IsScene { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsSubAsset
Is a sub asset. For example an asset in an addressable folder.
Declaration
public bool IsSubAsset { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
labels
The set of labels for this entry. There is no inherent limit to the number of labels.
Declaration
public HashSet<string> labels { get; }
Property Value
Type | Description |
---|---|
HashSet<String> |
MainAsset
The main asset object for this entry.
Declaration
public Object MainAsset { get; }
Property Value
Type | Description |
---|---|
Object |
ParentEntry
Declaration
public AddressableAssetEntry ParentEntry { get; set; }
Property Value
Type | Description |
---|---|
AddressableAssetEntry |
parentGroup
The asset group that this entry belongs to. An entry can only belong to a single group at a time.
Declaration
public AddressableAssetGroup parentGroup { get; set; }
Property Value
Type | Description |
---|---|
AddressableAssetGroup |
ReadOnly
Read only state of the entry.
Declaration
public bool ReadOnly { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
TargetAsset
The asset object for this entry.
Declaration
public Object TargetAsset { get; }
Property Value
Type | Description |
---|---|
Object |
Methods
CreateCatalogEntries(List<ContentCatalogDataEntry>, Boolean, String, IEnumerable<Object>, Object, HashSet<Type>)
Create all entries for this addressable asset. This will expand subassets (Sprites, Meshes, etc) and also different representations.
Declaration
public void CreateCatalogEntries(List<ContentCatalogDataEntry> entries, bool isBundled, string providerType, IEnumerable<object> dependencies, object extraData, HashSet<Type> providerTypes)
Parameters
Type | Name | Description |
---|---|---|
List<ContentCatalogDataEntry> | entries | The list of entries to fill in. |
Boolean | isBundled | Whether the entry is bundles or not. This will affect the load path. |
String | providerType | The provider type for the main entry. |
IEnumerable<Object> | dependencies | Keys of dependencies |
Object | extraData | Extra data to append to catalog entries. |
HashSet<Type> | providerTypes | Any unknown provider types are added to this set in order to ensure they are not stripped. |
CreateKeyList()
Creates a list of keys that can be used to load this entry.
Declaration
public List<object> CreateKeyList()
Returns
Type | Description |
---|---|
List<Object> | The list of keys. This will contain the address, the guid as a Hash128 if valid, all assigned labels, and the scene index if applicable. |
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 void GatherAllAssets(List<AddressableAssetEntry> assets, bool includeSelf, bool recurseAll, bool includeSubObjects, Func<AddressableAssetEntry, bool> entryFilter = null)
Parameters
Type | Name | Description |
---|---|---|
List<AddressableAssetEntry> | assets | 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 |
GetAssetLoadPath(Boolean)
The asset load path. This is used to determine the internal id of resource locations.
Declaration
public string GetAssetLoadPath(bool isBundled)
Parameters
Type | Name | Description |
---|---|---|
Boolean | isBundled | True if the asset will be contained in an asset bundle. |
Returns
Type | Description |
---|---|
String | Return the runtime path that should be used to load this entry. |
OnAfterDeserialize()
Implementation of ISerializationCallbackReceiver. Converts data from serializable form after deserialization.
Declaration
public void OnAfterDeserialize()
Implements
OnBeforeSerialize()
Implementation of ISerializationCallbackReceiver. Converts data to serializable form before serialization.
Declaration
public void OnBeforeSerialize()
Implements
SetAddress(String, Boolean)
Set the address of the entry.
Declaration
public void SetAddress(string addr, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
String | addr | The address. |
Boolean | postEvent | Post modification event. |
SetLabel(String, Boolean, Boolean, Boolean)
Set or unset a label on this entry.
Declaration
public bool SetLabel(string label, bool enable, bool force = false, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
String | label | The label name. |
Boolean | enable | Setting to true will add the label, false will remove it. |
Boolean | force | When enable is true, setting force to true will force the label to exist on the parent AddressableAssetSettings object if it does not already. |
Boolean | postEvent | Post modification event. |
Returns
Type | Description |
---|---|
Boolean |