ATAssetPostprocessor.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using UnityEditor;
  3. using UnityEngine;
  4. using AnyThink.Scripts.IntegrationManager.Editor;
  5. [InitializeOnLoad]
  6. public class ATAssetPostprocessor : AssetPostprocessor
  7. {
  8. private static readonly string TAG = "ATAssetPostprocessor";
  9. static ATAssetPostprocessor()
  10. {
  11. log("ATAssetPostprocessor is now initialized!");
  12. }
  13. void OnPostprocessAsset(string path)
  14. {
  15. log("OnPostprocessAsset() >>> path: " + path + " assetPath: " + assetPath);
  16. }
  17. static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
  18. {
  19. foreach (string str in importedAssets)
  20. {
  21. log("imported Asset: " + str);
  22. }
  23. foreach (string str in deletedAssets)
  24. {
  25. log("Deleted Asset: " + str);
  26. }
  27. for (int i = 0; i < movedAssets.Length; i++)
  28. {
  29. log("Moved Asset: " + movedAssets[i] + " from: " + movedFromAssetPaths[i]);
  30. }
  31. }
  32. void OnPreprocessAsset()
  33. {
  34. log("OnPreprocessAsset() >>> called assetPath: " + assetPath);
  35. }
  36. private static void log(string msg)
  37. {
  38. ATLog.log(TAG, msg);
  39. }
  40. }