Class AddressableAssetSettings
Contains editor data for the addressables system.
Inheritance
Namespace: UnityEditor.AddressableAssets
Syntax
public class AddressableAssetSettings : ScriptableObject
Fields
kDefaultConfigFolder
The default folder for the serialized version of this class.
Declaration
public const string kDefaultConfigFolder = "Assets/AddressableAssetsData"
Field Value
Type | Description |
---|---|
System.String |
kDefaultConfigName
Default name for the config object.
Declaration
public const string kDefaultConfigName = "AddressableAssetSettings"
Field Value
Type | Description |
---|---|
System.String |
kNewGroupName
Default name of a newly created group.
Declaration
public const string kNewGroupName = "New Group"
Field Value
Type | Description |
---|---|
System.String |
Properties
activeProfileId
The active profile id.
Declaration
public string activeProfileId { get; set; }
Property Value
Type | Description |
---|---|
System.String |
AssetPath
The path of the settings asset.
Declaration
public string AssetPath { get; }
Property Value
Type | Description |
---|---|
System.String |
buildSettings
Build settings object.
Declaration
public AddressableAssetBuildSettings buildSettings { get; }
Property Value
Type | Description |
---|---|
AddressableAssetBuildSettings |
ConfigFolder
The folder of the settings asset.
Declaration
public string ConfigFolder { get; }
Property Value
Type | Description |
---|---|
System.String |
currentHash
Hash of the current settings. This value is recomputed if anything changes.
Declaration
public Hash128 currentHash { get; }
Property Value
Type | Description |
---|---|
Hash128 |
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 |
GroupFolder
The folder for the group assets.
Declaration
public string GroupFolder { get; }
Property Value
Type | Description |
---|---|
System.String |
groups
List of asset groups.
Declaration
public List<AddressableAssetGroup> groups { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<AddressableAssetGroup> |
OnModification
Event for watching settings changes.
Declaration
public Action<AddressableAssetSettings, AddressableAssetSettings.ModificationEvent, object> OnModification { get; set; }
Property Value
Type | Description |
---|---|
System.Action<AddressableAssetSettings, AddressableAssetSettings.ModificationEvent, System.Object> |
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 |
---|---|
System.String |
profileSettings
Profile settings object.
Declaration
public AddressableAssetProfileSettings profileSettings { get; }
Property Value
Type | Description |
---|---|
AddressableAssetProfileSettings |
Methods
AddLabel(String, Boolean)
Add a new label.
Declaration
public void AddLabel(string label, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | label | The label name. |
System.Boolean | postEvent | Send modification event. |
ConvertGroup(AddressableAssetGroup, Type)
Obsolete - Convert a group to a new processor type.
Declaration
public void ConvertGroup(AddressableAssetGroup group, Type processorType)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetGroup | group | The group to convert. |
System.Type | processorType | The new processor type |
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 |
---|---|---|
System.String | guid | The guid of the asset reference. |
Returns
Type | Description |
---|---|
AssetReference | Returns the newly created AssetReference. |
CreateGroup(String, Type, Boolean, Boolean, Boolean)
Create a new asset group.
Declaration
public AddressableAssetGroup CreateGroup(string groupName, Type processorType, bool setAsDefaultGroup, bool readOnly, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | groupName | The group name. |
System.Type | processorType | The processor type. |
System.Boolean | setAsDefaultGroup | Set the new group as the default group. |
System.Boolean | readOnly | Is the new group read only. |
System.Boolean | postEvent | Post modification event. |
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 |
---|---|---|
System.String | guid | The asset guid. |
AddressableAssetGroup | targetParent | The group to add the entry to. |
System.Boolean | readOnly | Is the new entry read only. |
System.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 |
---|---|---|
System.String | guid | The asset guid. |
Returns
Type | Description |
---|---|
AddressableAssetEntry | The found entry or null. |
FindGroup(String)
Find asset group by name.
Declaration
public AddressableAssetGroup FindGroup(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the group. |
Returns
Type | Description |
---|---|
AddressableAssetGroup | The group found or null. |
GetAllAssets(List<AddressableAssetEntry>)
Gets all asset entries from all groups.
Declaration
public void GetAllAssets(List<AddressableAssetEntry> assets)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<AddressableAssetEntry> | assets | The list of asset entries. |
GetDefault(Boolean, Boolean)
Get the default addressables settings object.
Declaration
public static AddressableAssetSettings GetDefault(bool create, bool browse)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | create | Create a new settings object if not found. |
System.Boolean | browse | Prompt the user with a dialog to browse for the location of the settings asset. |
Returns
Type | Description |
---|---|
AddressableAssetSettings |
RemoveAssetEntry(String, Boolean)
Remove an asset entry.
Declaration
public bool RemoveAssetEntry(string guid, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | guid | The guid of the asset. |
System.Boolean | postEvent | Send modifcation event. |
Returns
Type | Description |
---|---|
System.Boolean | True if the entry was found and removed. |
RemoveGroup(AddressableAssetGroup)
Remove an asset group.
Declaration
public void RemoveGroup(AddressableAssetGroup g)
Parameters
Type | Name | Description |
---|---|---|
AddressableAssetGroup | g |
RemoveLabel(String, Boolean)
Remove a label by name.
Declaration
public void RemoveLabel(string label, bool postEvent = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | label | The label name. |
System.Boolean | postEvent | Send modification event. |