Exemple #1
0
 public void Merge(AssetChanges other)
 {
     Imported  = Merge(Imported, other.Imported);
     Deleted   = Merge(Deleted, other.Deleted);
     MovedFrom = Merge(MovedFrom, other.MovedFrom);
     MovedTo   = Merge(MovedTo, other.MovedTo);
 }
Exemple #2
0
        public static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            if (SceneSaved != null)
            {
                importedAssets.Where(p => p.EndsWith(".unity")).Distinct().ForEach(p => SceneSaved(p));
            }

            if (importedAssets.Length > 0 && AssetImported != null)
            {
                importedAssets.Distinct().ForEach(p => AssetImported(p));
            }

            if (deletedAssets.Length > 0 && AssetsDeleted != null)
            {
                AssetsDeleted(deletedAssets);
            }

            if (importedAssets.Length > 0 && AssetsImported != null)
            {
                AssetsImported(importedAssets);
            }

            if (movedAssets.Length > 0 && AssetsMoved != null)
            {
                AssetsMoved(movedAssets);
            }

            if (AssetsChanged == null && DelayedAssetsChanged == null)
            {
                return;
            }

            AssetChanges changes = new AssetChanges(importedAssets, deletedAssets, movedAssets, movedFromAssetPaths);

            if (AssetsChanged != null)
            {
                AssetsChanged(changes);
            }

            if (DelayedAssetsChanged != null)
            {
                s_LastChanges.Merge(changes);

                if (EditorApplication.timeSinceStartup > s_LastChangesTime)
                {
                    EditorApplication.delayCall += OnDelayCall;
                    s_LastChangesTime            = EditorApplication.timeSinceStartup + 1;
                }
            }
        }
Exemple #3
0
 private static void OnDelayCall()
 {
     DelayedAssetsChanged?.Invoke(s_LastChanges);
     s_LastChanges = new AssetChanges();
 }