Modification events
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> OnModificationGlobalpublic Action<AddressableAssetSettings, ModificationEvent, object> OnModification { get; set; }
which can be found on AddressableAssetSettings through a static, or instance, accessors respectively.
Code Samples
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.
The Data Passed with Each ModificationEvent:
- GroupAdded
The data passed with this event is the
AddressableAssetGroup, or list of groups, that were added. - GroupRemoved
The data passed with this event is the
AddressableAssetGroup, or list of groups, that were removed. - GroupRenamed
The data passed with this event is the
AddressableAssetGroup, or list of groups, that were renamed. - GroupSchemaAdded
The data passed with this event is the
AddressableAssetGroup, or list of groups, that had schemas added to them. - GroupSchemaRemoved
The data passed with this event is the
AddressableAssetGroup, or list of groups, that had schemas removed from them. - GroupSchemaModified
The data passed with this event is the
AddressableAssetGroupSchemathat was modified. - GroupTemplateAdded
The data passed with this event is the
ScriptableObject, typically one that implementsIGroupTemplate, that was the added Group Template object. - GroupTemplateRemoved
The data passed with this event is the
ScriptableObject, typically one that implementsIGroupTemplate, that was the removed Group Template object. - GroupTemplateSchemaAdded
The data passed with this event is the
AddressableAssetGroupTemplatethat had a schema added. - GroupTemplateSchemaRemoved
The data passed with this event is the
AddressableAssetGroupTemplatethat had a schema removed. - EntryCreated
The data passed with this event is the
AddressableAssetEntrythat was created. - EntryAdded
The data passed with this event is the
AddressableAssetEntry, or list of entries, that were added. - EntryMoved
The data passed with this event is the
AddressableAssetEntry, or list of entries, that were moved from one group to another. - EntryRemoved
The data passed with this event is the
AddressableAssetEntry, or list of entries, that were removed. - LabelAdded
The data passed with this event is the
stringlabel that was added. - LabelRemoved
The data passed with this event is the
stringlabel that was removed. - ProfileAdded
The data passed with this event is [
BuildProfile] that was added. - ProfileRemoved
The data passed with this event is the
stringof the profile ID that was removed. - ProfileModified
The data passed with this event is [
BuildProfile] that was modified, ornullif a batch ofBuildProfileswere modified. - ActiveProfileSet
The data passed with this event if the
stringof the profile ID that is set as the active profile. - EntryModified
The data passed with this event is the
AddressableAssetEntry, or list of entries, that were modified. - BuildSettingsChanged
The data passed with this event is the
AddressableAssetBuildSettingsobject that was modified. - ActiveBuildScriptChanged
The data passed with this event is the
IDataBuilderbuild script that was set as the active builder. - DataBuilderAdded
The data passed with this event is the
ScriptableObject, typically one that implementsIDataBuilder, that was added to the list of DataBuilders. - DataBuilderRemoved
The data passed with this event is the
ScriptableObject, typically one that implementsIDataBuilder, that was removed from the list of DataBuilders. - InitializationObjectAdded
The data passed with this event is the
ScriptableObject, typically one that implementsIObjectInitializationDataProvider, that was added to the list of InitializationObjects. - InitializationObjectRemoved
The data passed with this event is the
ScriptableObject, typically one that implementsIObjectInitializationDataProvider, that was removed from the list of InitializationObjects. - ActivePlayModeScriptChanged
The data passed with this event is the
IDataBuilderthat was set as the new active play mode data builder. - BatchModification
The data passed with this event is
null. This event is primarily used to indicate several modification events happening at the same time and theAddressableAssetSettingsobject needed to be marked dirty. - HostingServicesManagerModified
The data passed is either going to be the
HostingServicesManager, or theHttpHostingServicethat were modified. - GroupMoved
The data passed with this event is the full list of
AddressableAssetGroups. - CertificateHandlerChanged
The data passed with this event is the new
System.Typeof the Certificate Handler to be used.