|
| 1 | +// Unity C# reference source |
| 2 | +// Copyright (c) Unity Technologies. For terms of use, see |
| 3 | +// https://unity3d.com/legal/licenses/Unity_Reference_Only_License |
| 4 | + |
| 5 | +using System; |
| 6 | +using System.Collections.Generic; |
| 7 | + |
| 8 | +namespace UnityEditor.Experimental |
| 9 | +{ |
| 10 | + internal abstract class AssetsModifiedProcessor |
| 11 | + { |
| 12 | + internal HashSet<string> assetsReportedChanged { get; set; } |
| 13 | + |
| 14 | + protected void ReportAssetChanged(string assetChanged) |
| 15 | + { |
| 16 | + if (assetsReportedChanged == null) |
| 17 | + throw new InvalidOperationException("Cannot call ReportAssetChanged outside of the OnAssetsModified callback"); |
| 18 | + |
| 19 | + assetsReportedChanged.Add(assetChanged); |
| 20 | + } |
| 21 | + |
| 22 | + //Note: changedAssets including added and moved assets may be a usability issue. Review before making public. |
| 23 | + ///<summary>Fired when the [[AssetDatabase]] detects Asset changes before any Assets are imported.</summary> |
| 24 | + ///<param name="changedAssets">Paths to the Assets whose file contents have changed. Includes all added and moved Assets.</param> |
| 25 | + ///<param name="addedAssets">Paths to added Assets.</param> |
| 26 | + ///<param name="deletedAssets">Paths to deleted Assets.</param> |
| 27 | + ///<param name="movedAssets">Array of AssetMoveInfo that contains the previous and current location of any moved Assets.</param> |
| 28 | + ///<description> An Asset will only be reported moved if its .meta file is moved as well.</description> |
| 29 | + protected abstract void OnAssetsModified(string[] changedAssets, string[] addedAssets, string[] deletedAssets, AssetMoveInfo[] movedAssets); |
| 30 | + |
| 31 | + internal void Internal_OnAssetsModified(string[] changedAssets, string[] addedAssets, string[] deletedAssets, AssetMoveInfo[] movedAssets) |
| 32 | + { |
| 33 | + OnAssetsModified(changedAssets, addedAssets, deletedAssets, movedAssets); |
| 34 | + } |
| 35 | + } |
| 36 | +} |
0 commit comments