Modification events are used to signal to parts of the Addressables system when certain data is manipulated, such as an AddressableAssetGroup
or an AddressableAssetEntry
getting added or removed.
Modification events are triggered as part of SetDirty
calls inside of Addressables. SetDirty
is used to indicate when an asset needs to be re-serialized by the AssetDatabase
. As part of this SetDirty
, two modification event callbacks can trigger:
public static event Action<AddressableAssetSettings, ModificationEvent, object> OnModificationGlobal
public Action<AddressableAssetSettings, ModificationEvent, object> OnModification { get; set; }
which can be found on AddressableAssetSettings
through a static, or instance, accessors respectively.
AddressableAssetSettings.OnModificationGlobal += (settings, modificationEvent, data) =>
{
if(modificationEvent == AddressableAssetSettings.ModificationEvent.EntryAdded)
{
//Do work
}
};
AddressableAssetSettingsDefaultObject.Settings.OnModification += (settings, modificationEvent, data) =>
{
if (modificationEvent == AddressableAssetSettings.ModificationEvent.EntryAdded)
{
//Do work
}
};
Modification events pass in a generic object
for the data associated with the event. Below is a list of the modification events and the data types that are passed with them.
AddressableAssetGroup
, or list of groups, that were added.AddressableAssetGroup
, or list of groups, that were removed.AddressableAssetGroup
, or list of groups, that were renamed.AddressableAssetGroup
, or list of groups, that had schemas added to them.AddressableAssetGroup
, or list of groups, that had schemas removed from them.AddressableAssetGroupSchema
that was modified.ScriptableObject
, typically one that implements IGroupTemplate
, that was the added Group Template object.ScriptableObject
, typically one that implements IGroupTemplate
, that was the removed Group Template object.AddressableAssetGroupTemplate
that had a schema added.AddressableAssetGroupTemplate
that had a schema removed.AddressableAssetEntry
that was created.AddressableAssetEntry
, or list of entries, that were added.AddressableAssetEntry
, or list of entries, that were moved from one group to another.AddressableAssetEntry
, or list of entries, that were removed.string
label that was added.string
label that was removed.BuildProfile
that was added.string
of the profile ID that was removed.BuildProfile
that was modified, or null
if a batch of BuildProfiles
were modified.string
of the profile ID that is set as the active profile.AddressableAssetEntry
, or list of entries, that were modified.AddressableAssetBuildSettings
object that was modified.IDataBuilder
build script that was set as the active builder.ScriptableObject
, typically one that implements IDataBuilder
, that was added to the list of DataBuilders.ScriptableObject
, typically one that implements IDataBuilder
, that was removed from the list of DataBuilders.ScriptableObject
, typically one that implements IObjectInitializationDataProvider
, that was added to the list of InitializationObjects.ScriptableObject
, typically one that implements IObjectInitializationDataProvider
, that was removed from the list of InitializationObjects.IDataBuilder
that was set as the new active play mode data builder.null
. This event is primarily used to indicate several modification events happening at the same time and the AddressableAssetSettings
object needed to be marked dirty.HostingServicesManager
, or the HttpHostingService
that were modified.AddressableAssetGroups
.System.Type
of the Certificate Handler to be used.