mirror of https://github.com/tuyoogame/YooAsset
Update AssetBundleBuilder
parent
ea9b8874cc
commit
e68ece6925
|
@ -26,6 +26,17 @@ namespace YooAsset.Editor
|
|||
if (string.IsNullOrEmpty(buildParameters.PipelineOutputDirectory))
|
||||
throw new Exception("输出目录不能为空");
|
||||
|
||||
// 检测当前是否正在构建资源包
|
||||
if (BuildPipeline.isBuildingPlayer)
|
||||
throw new Exception("当前正在构建资源包,请结束后再试");
|
||||
|
||||
// 检测是否有未保存场景
|
||||
if (EditorTools.HasDirtyScenes())
|
||||
throw new Exception("检测到未保存的场景文件");
|
||||
|
||||
// 保存改动的资源
|
||||
AssetDatabase.SaveAssets();
|
||||
|
||||
// 增量更新时候的必要检测
|
||||
var buildMode = buildParameters.Parameters.BuildMode;
|
||||
if (buildMode == EBuildMode.IncrementalBuild)
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.IO;
|
|||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
|
@ -265,6 +266,20 @@ namespace YooAsset.Editor
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region SceneUtility
|
||||
public static bool HasDirtyScenes()
|
||||
{
|
||||
var sceneCount = EditorSceneManager.sceneCount;
|
||||
for (var i = 0; i < sceneCount; ++i)
|
||||
{
|
||||
var scene = EditorSceneManager.GetSceneAt(i);
|
||||
if (scene.isDirty)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 文件
|
||||
/// <summary>
|
||||
/// 创建文件所在的目录
|
||||
|
|
Loading…
Reference in New Issue