AssetBundleBackupManifest.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using XGame.Editor.Asset;
  2. using UnityEditor;
  3. using UnityEngine;
  4. namespace XGame.Editor.Build.AssetBundles
  5. {
  6. /// <summary>
  7. /// 备份用Manifest文件
  8. /// </summary>
  9. public class AssetBundleBackupManifest : ScriptableObject
  10. {
  11. #region static
  12. public static string ManifestPath => $"{PathDefine.ConfigsRelative}AssetBundleBackupManifest.asset";
  13. public static AssetBundleBackupManifest Load()
  14. {
  15. return AssetDatabase.LoadAssetAtPath<AssetBundleBackupManifest>(ManifestPath);
  16. }
  17. public static void Save(AssetBundleBackupInfo[] backupInfos, bool refresh)
  18. {
  19. var manifest = Load();
  20. if (manifest == null)
  21. {
  22. manifest = ScriptableObject.CreateInstance<AssetBundleBackupManifest>();
  23. AssetDatabase.CreateAsset(manifest, ManifestPath);
  24. }
  25. manifest.bundleInfos = backupInfos;
  26. EditorUtility.SetDirty(manifest);
  27. if (refresh)
  28. {
  29. AssetDatabase.SaveAssets();
  30. AssetDatabase.Refresh();
  31. }
  32. }
  33. #endregion
  34. public AssetBundleBackupInfo[] bundleInfos;
  35. }
  36. }