UMPPostAssets.cs 1.1 KB

12345678910111213141516171819202122232425262728
  1. using System.IO;
  2. using UnityEditor;
  3. namespace UMP.Editor
  4. {
  5. public class UMPPostAssets : AssetPostprocessor
  6. {
  7. private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
  8. {
  9. string assetNameWithExtension = string.Join(".", new string[] { UMPSettings.SETTINGS_FILE_NAME, "asset" });
  10. for (int i = 0; i < movedAssets.Length; i++)
  11. {
  12. if (movedFromAssetPaths[i].Equals(UMPSettings.Instance.AssetPath))
  13. UMPSettings.Instance.AssetPath = movedAssets[i];
  14. }
  15. for (int i = 0; i < importedAssets.Length; i++)
  16. {
  17. if (Path.GetFileName(importedAssets[i]).Equals(assetNameWithExtension))
  18. {
  19. UMPSettingsEditor.UpdateMobileLibraries(UMPSettings.Platforms.Android, UMPSettings.Instance.PlayersAndroid);
  20. UMPSettingsEditor.UpdateMobileLibraries(UMPSettings.Platforms.iOS, UMPSettings.Instance.PlayersIPhone);
  21. }
  22. }
  23. }
  24. }
  25. }