ProcessAllAssets.cs 812 B

1234567891011121314151617181920212223
  1. using UnityEditor;
  2. namespace Asset_Cleaner {
  3. class ProcessAllAssets : AssetPostprocessor {
  4. static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) {
  5. if (!AufCtx.InitStarted) return;
  6. if (!Globals<BacklinkStore>.Value.Initialized) return;
  7. var store = Globals<BacklinkStore>.Value;
  8. var length = movedAssets.Length;
  9. for (var i = 0; i < length; i++)
  10. store.Replace(movedFromAssetPaths[i], movedAssets[i]);
  11. foreach (var path in deletedAssets)
  12. store.Remove(path);
  13. foreach (var path in importedAssets)
  14. store.RebuildFor(path, true);
  15. store.UpdateUnusedAssets();
  16. }
  17. }
  18. }