diff --git a/Assets/SmartAddresser/Editor/Core/Models/Services/ApplyLayoutRuleService.cs b/Assets/SmartAddresser/Editor/Core/Models/Services/ApplyLayoutRuleService.cs index 1a9b742..14790ad 100644 --- a/Assets/SmartAddresser/Editor/Core/Models/Services/ApplyLayoutRuleService.cs +++ b/Assets/SmartAddresser/Editor/Core/Models/Services/ApplyLayoutRuleService.cs @@ -147,23 +147,23 @@ private bool TryAddEntry( // Set group and address. var entryAdapter = _addressableSettingsAdapter.CreateOrMoveEntry(addressableGroupName, assetGuid, invokeModificationEvent); - entryAdapter.SetAddress(address); + entryAdapter.SetAddress(address, invokeModificationEvent); // Add labels to addressable settings if not exists. var labels = _layoutRule.ProvideLabels(assetPath, assetType, isFolder, doSetup); var addressableLabels = _addressableSettingsAdapter.GetLabels(); foreach (var label in labels) if (!addressableLabels.Contains(label)) - _addressableSettingsAdapter.AddLabel(label); + _addressableSettingsAdapter.AddLabel(label, invokeModificationEvent); // Remove old labels. var oldLabels = entryAdapter.Labels.ToArray(); foreach (var label in oldLabels) - entryAdapter.SetLabel(label, false); + entryAdapter.SetLabel(label, false, invokeModificationEvent); // Add new labels. foreach (var label in labels) - entryAdapter.SetLabel(label, true); + entryAdapter.SetLabel(label, true, invokeModificationEvent); return true; } diff --git a/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/AddresableAssetSettingsAdapter.cs b/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/AddresableAssetSettingsAdapter.cs index 08edb51..1474010 100644 --- a/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/AddresableAssetSettingsAdapter.cs +++ b/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/AddresableAssetSettingsAdapter.cs @@ -61,15 +61,15 @@ public IReadOnlyList GetLabels() } /// - public void AddLabel(string label) + public void AddLabel(string label, bool invokeModificationEvent) { - _settings.AddLabel(label); + _settings.AddLabel(label, invokeModificationEvent); } /// - public void RemoveLabel(string label) + public void RemoveLabel(string label, bool invokeModificationEvent) { - _settings.RemoveLabel(label); + _settings.RemoveLabel(label, invokeModificationEvent); } } } diff --git a/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/AddressableAssetEntryAdapter.cs b/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/AddressableAssetEntryAdapter.cs index dc38136..600a3b1 100644 --- a/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/AddressableAssetEntryAdapter.cs +++ b/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/AddressableAssetEntryAdapter.cs @@ -22,15 +22,15 @@ public AddressableAssetEntryAdapter(AddressableAssetEntry entry) public string GroupName => _entry.parentGroup.Name; /// - public void SetAddress(string address) + public void SetAddress(string address, bool invokeModificationEvent) { - _entry.SetAddress(address); + _entry.SetAddress(address, invokeModificationEvent); } /// - public bool SetLabel(string label, bool enable) + public bool SetLabel(string label, bool enable, bool invokeModificationEvent) { - return _entry.SetLabel(label, enable); + return _entry.SetLabel(label, enable, postEvent:invokeModificationEvent); } } } diff --git a/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/IAddressableAssetEntryAdapter.cs b/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/IAddressableAssetEntryAdapter.cs index 8b06a2d..812f0cb 100644 --- a/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/IAddressableAssetEntryAdapter.cs +++ b/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/IAddressableAssetEntryAdapter.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using UnityEditor.AddressableAssets.Settings; namespace SmartAddresser.Editor.Foundation.AddressableAdapter { @@ -26,14 +27,22 @@ public interface IAddressableAssetEntryAdapter /// Set a address of the entry. /// /// - void SetAddress(string address); + /// + /// If true, call after + /// creating or moving. + /// + void SetAddress(string address, bool invokeModificationEvent); /// /// Set or unset a label on this entry. /// /// The label name. /// Setting to true will add the label, false will remove it. + /// + /// If true, call after + /// creating or moving. + /// /// - bool SetLabel(string label, bool enable); + bool SetLabel(string label, bool enable, bool invokeModificationEvent); } } diff --git a/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/IAddressableAssetSettingsAdapter.cs b/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/IAddressableAssetSettingsAdapter.cs index 2c1adb6..aa07f14 100644 --- a/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/IAddressableAssetSettingsAdapter.cs +++ b/Assets/SmartAddresser/Editor/Foundation/AddressableAdapter/IAddressableAssetSettingsAdapter.cs @@ -63,12 +63,20 @@ public interface IAddressableAssetSettingsAdapter /// Add a new label. /// /// The label name. - void AddLabel(string label); + /// + /// If true, call after + /// creating or moving. + /// + void AddLabel(string label, bool invokeModificationEvent); /// /// Remove a label by name. /// /// The label name. - void RemoveLabel(string label); + /// + /// If true, call after + /// creating or moving. + /// + void RemoveLabel(string label, bool invokeModificationEvent); } } diff --git a/Assets/SmartAddresser/Tests/Editor/Foundation/FakeAddressableAssetEntryAdapter.cs b/Assets/SmartAddresser/Tests/Editor/Foundation/FakeAddressableAssetEntryAdapter.cs index 8aa7e43..531a0ec 100644 --- a/Assets/SmartAddresser/Tests/Editor/Foundation/FakeAddressableAssetEntryAdapter.cs +++ b/Assets/SmartAddresser/Tests/Editor/Foundation/FakeAddressableAssetEntryAdapter.cs @@ -19,13 +19,13 @@ public FakeAddressableAssetEntryAdapter(IEnumerable labels = null) public string GroupName { get; private set; } /// - public void SetAddress(string address) + public void SetAddress(string address, bool _) { Address = address; } /// - public bool SetLabel(string label, bool enable) + public bool SetLabel(string label, bool enable, bool _) { if (enable) return Labels.Add(label); diff --git a/Assets/SmartAddresser/Tests/Editor/Foundation/FakeAddressableAssetSettingsAdapter.cs b/Assets/SmartAddresser/Tests/Editor/Foundation/FakeAddressableAssetSettingsAdapter.cs index a486d7e..835e07e 100644 --- a/Assets/SmartAddresser/Tests/Editor/Foundation/FakeAddressableAssetSettingsAdapter.cs +++ b/Assets/SmartAddresser/Tests/Editor/Foundation/FakeAddressableAssetSettingsAdapter.cs @@ -64,13 +64,13 @@ public IReadOnlyList GetLabels() } /// - public void AddLabel(string label) + public void AddLabel(string label, bool _) { _labels.Add(label); } /// - public void RemoveLabel(string label) + public void RemoveLabel(string label, bool _) { _labels.Remove(label); }