using XGame.Editor.Asset;
using UnityEditor;
using UnityEngine;
namespace XGame.Editor.Build.AssetBundles
{
///
/// 备份用Manifest文件
///
public class AssetBundleBackupManifest : ScriptableObject
{
#region static
public static string ManifestPath => $"{PathDefine.ConfigsRelative}AssetBundleBackupManifest.asset";
public static AssetBundleBackupManifest Load()
{
return AssetDatabase.LoadAssetAtPath(ManifestPath);
}
public static void Save(AssetBundleBackupInfo[] backupInfos, bool refresh)
{
var manifest = Load();
if (manifest == null)
{
manifest = ScriptableObject.CreateInstance();
AssetDatabase.CreateAsset(manifest, ManifestPath);
}
manifest.bundleInfos = backupInfos;
EditorUtility.SetDirty(manifest);
if (refresh)
{
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
}
#endregion
public AssetBundleBackupInfo[] bundleInfos;
}
}