mirror of https://github.com/tuyoogame/YooAsset
Compare commits
16 Commits
e7ed7788fa
...
f7f8312a2e
Author | SHA1 | Date |
---|---|---|
absences | f7f8312a2e | |
何冠峰 | 8c532798cb | |
何冠峰 | 17aed56270 | |
何冠峰 | 1f07411dde | |
何冠峰 | 906e0e3554 | |
何冠峰 | 22958923ad | |
何冠峰 | a5f94198c0 | |
何冠峰 | 8a2bac8770 | |
何冠峰 | 3fd24f6f19 | |
何冠峰 | c30292013b | |
何冠峰 | edd6db731f | |
何冠峰 | 19e0c7b01a | |
何冠峰 | 58fc76b8d2 | |
何冠峰 | 1638bb301d | |
absences | 008a3e1893 | |
unknown | fa572e6ae1 |
|
@ -22,7 +22,7 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetStreamingAssetsRoot()
|
public static string GetStreamingAssetsRoot()
|
||||||
{
|
{
|
||||||
return $"{Application.dataPath}/StreamingAssets/{YooAssetSettingsData.Setting.DefaultYooFolderName}/";
|
return YooAssetSettingsData.GetYooEditorBuildinRoot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,18 +18,6 @@ namespace YooAsset.Editor
|
||||||
EditorPrefs.SetInt(key, (int)buildPipeline);
|
EditorPrefs.SetInt(key, (int)buildPipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
// EBuildMode
|
|
||||||
public static EBuildMode GetPackageBuildMode(string packageName, EBuildPipeline buildPipeline)
|
|
||||||
{
|
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildMode)}";
|
|
||||||
return (EBuildMode)EditorPrefs.GetInt(key, (int)EBuildMode.ForceRebuild);
|
|
||||||
}
|
|
||||||
public static void SetPackageBuildMode(string packageName, EBuildPipeline buildPipeline, EBuildMode buildMode)
|
|
||||||
{
|
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildMode)}";
|
|
||||||
EditorPrefs.SetInt(key, (int)buildMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ECompressOption
|
// ECompressOption
|
||||||
public static ECompressOption GetPackageCompressOption(string packageName, EBuildPipeline buildPipeline)
|
public static ECompressOption GetPackageCompressOption(string packageName, EBuildPipeline buildPipeline)
|
||||||
{
|
{
|
||||||
|
@ -89,5 +77,17 @@ namespace YooAsset.Editor
|
||||||
string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionClassName";
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionClassName";
|
||||||
EditorPrefs.SetString(key, encyptionClassName);
|
EditorPrefs.SetString(key, encyptionClassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClearBuildCache
|
||||||
|
public static bool GetPackageClearBuildCache(string packageName, EBuildPipeline buildPipeline)
|
||||||
|
{
|
||||||
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ClearBuildCache";
|
||||||
|
return EditorPrefs.GetInt(key, 0) > 0;
|
||||||
|
}
|
||||||
|
public static void SetPackageClearBuildCache(string packageName, EBuildPipeline buildPipeline, bool clearBuildCache)
|
||||||
|
{
|
||||||
|
string key = $"{Application.productName}_{packageName}_{buildPipeline}_ClearBuildCache";
|
||||||
|
EditorPrefs.SetInt(key, clearBuildCache ? 1 : 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -69,6 +69,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
_pipelineMenu = new ToolbarMenu();
|
_pipelineMenu = new ToolbarMenu();
|
||||||
_pipelineMenu.style.width = 200;
|
_pipelineMenu.style.width = 200;
|
||||||
|
_pipelineMenu.menu.AppendAction(EBuildPipeline.EditorSimulateBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.EditorSimulateBuildPipeline);
|
||||||
_pipelineMenu.menu.AppendAction(EBuildPipeline.BuiltinBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.BuiltinBuildPipeline);
|
_pipelineMenu.menu.AppendAction(EBuildPipeline.BuiltinBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.BuiltinBuildPipeline);
|
||||||
_pipelineMenu.menu.AppendAction(EBuildPipeline.ScriptableBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.ScriptableBuildPipeline);
|
_pipelineMenu.menu.AppendAction(EBuildPipeline.ScriptableBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.ScriptableBuildPipeline);
|
||||||
_pipelineMenu.menu.AppendAction(EBuildPipeline.RawFileBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.RawFileBuildPipeline);
|
_pipelineMenu.menu.AppendAction(EBuildPipeline.RawFileBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.RawFileBuildPipeline);
|
||||||
|
@ -93,7 +94,11 @@ namespace YooAsset.Editor
|
||||||
_pipelineMenu.text = _buildPipeline.ToString();
|
_pipelineMenu.text = _buildPipeline.ToString();
|
||||||
|
|
||||||
var buildTarget = EditorUserBuildSettings.activeBuildTarget;
|
var buildTarget = EditorUserBuildSettings.activeBuildTarget;
|
||||||
if (_buildPipeline == EBuildPipeline.BuiltinBuildPipeline)
|
if (_buildPipeline == EBuildPipeline.EditorSimulateBuildPipeline)
|
||||||
|
{
|
||||||
|
var viewer = new EditorSimulateBuildPipelineViewer(_buildPackage, buildTarget, _container);
|
||||||
|
}
|
||||||
|
else if (_buildPipeline == EBuildPipeline.BuiltinBuildPipeline)
|
||||||
{
|
{
|
||||||
var viewer = new BuiltinBuildPipelineViewer(_buildPackage, buildTarget, _container);
|
var viewer = new BuiltinBuildPipelineViewer(_buildPackage, buildTarget, _container);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,71 +8,25 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模拟构建
|
/// 模拟构建
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static SimulateBuildResult SimulateBuild(string buildPipelineName, string packageName)
|
public static EditorSimulateBuildResult SimulateBuild(EditorSimulateBuildParam buildParam)
|
||||||
{
|
{
|
||||||
string packageVersion = "Simulate";
|
string packageName = buildParam.PackageName;
|
||||||
BuildResult buildResult;
|
var buildParameters = new EditorSimulateBuildParameters();
|
||||||
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
|
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
|
buildParameters.BuildPipeline = EBuildPipeline.EditorSimulateBuildPipeline.ToString();
|
||||||
|
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
||||||
|
buildParameters.PackageName = packageName;
|
||||||
|
buildParameters.PackageVersion = "Simulate";
|
||||||
|
buildParameters.FileNameStyle = EFileNameStyle.HashName;
|
||||||
|
buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
|
||||||
|
buildParameters.BuildinFileCopyParams = string.Empty;
|
||||||
|
|
||||||
if (buildPipelineName == EBuildPipeline.BuiltinBuildPipeline.ToString())
|
var pipeline = new EditorSimulateBuildPipeline();
|
||||||
{
|
BuildResult buildResult = pipeline.Run(buildParameters, false);
|
||||||
BuiltinBuildParameters buildParameters = new BuiltinBuildParameters();
|
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
|
||||||
buildParameters.BuildPipeline = buildPipelineName;
|
|
||||||
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
|
||||||
buildParameters.BuildMode = EBuildMode.SimulateBuild;
|
|
||||||
buildParameters.PackageName = packageName;
|
|
||||||
buildParameters.PackageVersion = packageVersion;
|
|
||||||
buildParameters.FileNameStyle = EFileNameStyle.HashName;
|
|
||||||
buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
|
|
||||||
buildParameters.BuildinFileCopyParams = string.Empty;
|
|
||||||
|
|
||||||
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
|
||||||
buildResult = pipeline.Run(buildParameters, false);
|
|
||||||
}
|
|
||||||
else if (buildPipelineName == EBuildPipeline.ScriptableBuildPipeline.ToString())
|
|
||||||
{
|
|
||||||
ScriptableBuildParameters buildParameters = new ScriptableBuildParameters();
|
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
|
||||||
buildParameters.BuildPipeline = buildPipelineName;
|
|
||||||
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
|
||||||
buildParameters.BuildMode = EBuildMode.SimulateBuild;
|
|
||||||
buildParameters.PackageName = packageName;
|
|
||||||
buildParameters.PackageVersion = packageVersion;
|
|
||||||
buildParameters.FileNameStyle = EFileNameStyle.HashName;
|
|
||||||
buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
|
|
||||||
buildParameters.BuildinFileCopyParams = string.Empty;
|
|
||||||
|
|
||||||
ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
|
|
||||||
buildResult = pipeline.Run(buildParameters, true);
|
|
||||||
}
|
|
||||||
else if (buildPipelineName == EBuildPipeline.RawFileBuildPipeline.ToString())
|
|
||||||
{
|
|
||||||
RawFileBuildParameters buildParameters = new RawFileBuildParameters();
|
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
|
||||||
buildParameters.BuildPipeline = buildPipelineName;
|
|
||||||
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
|
||||||
buildParameters.BuildMode = EBuildMode.SimulateBuild;
|
|
||||||
buildParameters.PackageName = packageName;
|
|
||||||
buildParameters.PackageVersion = packageVersion;
|
|
||||||
buildParameters.FileNameStyle = EFileNameStyle.HashName;
|
|
||||||
buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
|
|
||||||
buildParameters.BuildinFileCopyParams = string.Empty;
|
|
||||||
|
|
||||||
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
|
||||||
buildResult = pipeline.Run(buildParameters, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new System.NotImplementedException(buildPipelineName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回结果
|
|
||||||
if (buildResult.Success)
|
if (buildResult.Success)
|
||||||
{
|
{
|
||||||
SimulateBuildResult reulst = new SimulateBuildResult();
|
var reulst = new EditorSimulateBuildResult();
|
||||||
reulst.PackageRootDirectory = buildResult.OutputPackageDirectory;
|
reulst.PackageRootDirectory = buildResult.OutputPackageDirectory;
|
||||||
return reulst;
|
return reulst;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,6 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BuildTarget BuildTarget;
|
public BuildTarget BuildTarget;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 构建模式
|
|
||||||
/// </summary>
|
|
||||||
public EBuildMode BuildMode;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建的包裹名称
|
/// 构建的包裹名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -52,7 +47,12 @@ namespace YooAsset.Editor
|
||||||
public string PackageNote;
|
public string PackageNote;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否启用共享资源打包
|
/// 清空构建缓存文件
|
||||||
|
/// </summary>
|
||||||
|
public bool ClearBuildCacheFiles = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 启用共享资源打包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool EnableSharePackRule = false;
|
public bool EnableSharePackRule = false;
|
||||||
|
|
||||||
|
@ -99,16 +99,6 @@ namespace YooAsset.Editor
|
||||||
throw new Exception(message);
|
throw new Exception(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测是否有未保存场景
|
|
||||||
if (BuildMode != EBuildMode.SimulateBuild)
|
|
||||||
{
|
|
||||||
if (EditorTools.HasDirtyScenes())
|
|
||||||
{
|
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.FoundUnsavedScene, "Found unsaved scene !");
|
|
||||||
throw new Exception(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检测构建参数合法性
|
// 检测构建参数合法性
|
||||||
if (BuildTarget == BuildTarget.NoTarget)
|
if (BuildTarget == BuildTarget.NoTarget)
|
||||||
{
|
{
|
||||||
|
@ -136,34 +126,6 @@ namespace YooAsset.Editor
|
||||||
throw new Exception(message);
|
throw new Exception(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 强制构建删除包裹目录
|
|
||||||
if (BuildMode == EBuildMode.ForceRebuild)
|
|
||||||
{
|
|
||||||
string packageRootDirectory = GetPackageRootDirectory();
|
|
||||||
if (EditorTools.DeleteDirectory(packageRootDirectory))
|
|
||||||
{
|
|
||||||
BuildLogger.Log($"Delete package root directory: {packageRootDirectory}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 检测包裹输出目录是否存在
|
|
||||||
if (BuildMode != EBuildMode.SimulateBuild)
|
|
||||||
{
|
|
||||||
string packageOutputDirectory = GetPackageOutputDirectory();
|
|
||||||
if (Directory.Exists(packageOutputDirectory))
|
|
||||||
{
|
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.PackageOutputDirectoryExists, $"Package outout directory exists: {packageOutputDirectory}");
|
|
||||||
throw new Exception(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果输出目录不存在
|
|
||||||
string pipelineOutputDirectory = GetPipelineOutputDirectory();
|
|
||||||
if (EditorTools.CreateDirectory(pipelineOutputDirectory))
|
|
||||||
{
|
|
||||||
BuildLogger.Log($"Create pipeline output directory: {pipelineOutputDirectory}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置默认备注信息
|
// 设置默认备注信息
|
||||||
if (string.IsNullOrEmpty(PackageNote))
|
if (string.IsNullOrEmpty(PackageNote))
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建补丁清单文件到输出目录
|
/// 创建补丁清单文件到输出目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void CreateManifestFile(BuildContext context)
|
protected void CreateManifestFile(bool processBundleDepends, bool processBundleTags, BuildContext context)
|
||||||
{
|
{
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
|
@ -42,14 +42,13 @@ namespace YooAsset.Editor
|
||||||
manifest.BundleList = GetAllPackageBundle(buildMapContext);
|
manifest.BundleList = GetAllPackageBundle(buildMapContext);
|
||||||
manifest.AssetList = GetAllPackageAsset(buildMapContext);
|
manifest.AssetList = GetAllPackageAsset(buildMapContext);
|
||||||
|
|
||||||
if (buildParameters.BuildMode != EBuildMode.SimulateBuild)
|
// 处理资源包的依赖列表
|
||||||
{
|
if (processBundleDepends)
|
||||||
// 处理资源包的依赖列表
|
|
||||||
ProcessBundleDepends(context, manifest);
|
ProcessBundleDepends(context, manifest);
|
||||||
|
|
||||||
// 处理资源包的标签集合
|
// 处理资源包的标签集合
|
||||||
|
if (processBundleTags)
|
||||||
ProcessBundleTags(manifest);
|
ProcessBundleTags(manifest);
|
||||||
}
|
|
||||||
|
|
||||||
// 创建补丁清单文本文件
|
// 创建补丁清单文本文件
|
||||||
{
|
{
|
||||||
|
@ -197,9 +196,12 @@ namespace YooAsset.Editor
|
||||||
CacheBundleTags(bundleID, assetTags);
|
CacheBundleTags(bundleID, assetTags);
|
||||||
|
|
||||||
var packageBundle = manifest.BundleList[bundleID];
|
var packageBundle = manifest.BundleList[bundleID];
|
||||||
foreach (var dependBundleID in packageBundle.DependIDs)
|
if (packageBundle.DependIDs != null)
|
||||||
{
|
{
|
||||||
CacheBundleTags(dependBundleID, assetTags);
|
foreach (var dependBundleID in packageBundle.DependIDs)
|
||||||
|
{
|
||||||
|
CacheBundleTags(dependBundleID, assetTags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@ namespace YooAsset.Editor
|
||||||
buildReport.Summary.BuildSeconds = BuildRunner.TotalSeconds;
|
buildReport.Summary.BuildSeconds = BuildRunner.TotalSeconds;
|
||||||
buildReport.Summary.BuildTarget = buildParameters.BuildTarget;
|
buildReport.Summary.BuildTarget = buildParameters.BuildTarget;
|
||||||
buildReport.Summary.BuildPipeline = buildParameters.BuildPipeline;
|
buildReport.Summary.BuildPipeline = buildParameters.BuildPipeline;
|
||||||
buildReport.Summary.BuildMode = buildParameters.BuildMode;
|
|
||||||
buildReport.Summary.BuildPackageName = buildParameters.PackageName;
|
buildReport.Summary.BuildPackageName = buildParameters.PackageName;
|
||||||
buildReport.Summary.BuildPackageVersion = buildParameters.PackageVersion;
|
buildReport.Summary.BuildPackageVersion = buildParameters.PackageVersion;
|
||||||
buildReport.Summary.BuildPackageNote = buildParameters.PackageNote;
|
buildReport.Summary.BuildPackageNote = buildParameters.PackageNote;
|
||||||
|
@ -42,6 +41,7 @@ namespace YooAsset.Editor
|
||||||
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
|
||||||
|
|
||||||
// 构建参数
|
// 构建参数
|
||||||
|
buildReport.Summary.ClearBuildCacheFiles = buildParameters.ClearBuildCacheFiles;
|
||||||
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
buildReport.Summary.EnableSharePackRule = buildParameters.EnableSharePackRule;
|
||||||
buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ? "null" : buildParameters.EncryptionServices.GetType().FullName;
|
||||||
if (buildParameters.BuildPipeline == nameof(BuiltinBuildPipeline))
|
if (buildParameters.BuildPipeline == nameof(BuiltinBuildPipeline))
|
||||||
|
|
|
@ -12,16 +12,15 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生成资源构建上下文
|
/// 生成资源构建上下文
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BuildMapContext CreateBuildMap(BuildParameters buildParameters)
|
public BuildMapContext CreateBuildMap(bool simulateBuild, BuildParameters buildParameters)
|
||||||
{
|
{
|
||||||
BuildMapContext context = new BuildMapContext();
|
BuildMapContext context = new BuildMapContext();
|
||||||
var buildMode = buildParameters.BuildMode;
|
|
||||||
var packageName = buildParameters.PackageName;
|
var packageName = buildParameters.PackageName;
|
||||||
|
|
||||||
Dictionary<string, BuildAssetInfo> allBuildAssetInfos = new Dictionary<string, BuildAssetInfo>(1000);
|
Dictionary<string, BuildAssetInfo> allBuildAssetInfos = new Dictionary<string, BuildAssetInfo>(1000);
|
||||||
|
|
||||||
// 1. 获取所有收集器收集的资源
|
// 1. 获取所有收集器收集的资源
|
||||||
var collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName);
|
var collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(simulateBuild, packageName);
|
||||||
List<CollectAssetInfo> allCollectAssets = collectResult.CollectAssets;
|
List<CollectAssetInfo> allCollectAssets = collectResult.CollectAssets;
|
||||||
|
|
||||||
// 2. 剔除未被引用的依赖项资源
|
// 2. 剔除未被引用的依赖项资源
|
||||||
|
|
|
@ -65,32 +65,5 @@ namespace YooAsset.Editor
|
||||||
protected abstract string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
protected abstract string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
||||||
protected abstract string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
protected abstract string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
||||||
protected abstract long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
protected abstract long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
|
||||||
|
|
||||||
protected string GetFilePathTempHash(string filePath)
|
|
||||||
{
|
|
||||||
byte[] bytes = Encoding.UTF8.GetBytes(filePath);
|
|
||||||
return HashUtility.BytesMD5(bytes);
|
|
||||||
|
|
||||||
// 注意:在文件路径的哈希值冲突的情况下,可以使用下面的方法
|
|
||||||
//return $"{HashUtility.BytesMD5(bytes)}-{Guid.NewGuid():N}";
|
|
||||||
}
|
|
||||||
protected long GetBundleTempSize(BuildBundleInfo bundleInfo)
|
|
||||||
{
|
|
||||||
long tempSize = 0;
|
|
||||||
|
|
||||||
var assetPaths = bundleInfo.GetAllMainAssetPaths();
|
|
||||||
foreach (var assetPath in assetPaths)
|
|
||||||
{
|
|
||||||
long size = FileUtility.GetFileSize(assetPath);
|
|
||||||
tempSize += size;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tempSize == 0)
|
|
||||||
{
|
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.BundleTempSizeIsZero, $"Bundle temp size is zero, check bundle main asset list : {bundleInfo.BundleName}");
|
|
||||||
throw new Exception(message);
|
|
||||||
}
|
|
||||||
return tempSize;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,11 +20,6 @@ namespace YooAsset.Editor
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
var builtinBuildParameters = buildParametersContext.Parameters as BuiltinBuildParameters;
|
var builtinBuildParameters = buildParametersContext.Parameters as BuiltinBuildParameters;
|
||||||
|
|
||||||
// 模拟构建模式下跳过引擎构建
|
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// 开始构建
|
// 开始构建
|
||||||
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
|
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
|
||||||
BuildAssetBundleOptions buildOptions = builtinBuildParameters.GetBundleBuildOptions();
|
BuildAssetBundleOptions buildOptions = builtinBuildParameters.GetBundleBuildOptions();
|
||||||
|
|
|
@ -12,14 +12,9 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
||||||
|
|
||||||
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
|
||||||
{
|
{
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
||||||
{
|
|
||||||
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
CreateManifestFile(context);
|
CreateManifestFile(true, true, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
||||||
|
|
|
@ -9,17 +9,13 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
CreatePackagePatch(buildParameters, buildMapContext);
|
||||||
if (buildMode != EBuildMode.SimulateBuild)
|
|
||||||
{
|
|
||||||
CreatePackageCatalog(buildParameters, buildMapContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拷贝补丁文件到补丁包目录
|
/// 拷贝补丁文件到补丁包目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CreatePackageCatalog(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
|
private void CreatePackagePatch(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
|
||||||
{
|
{
|
||||||
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
|
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
|
||||||
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
||||||
|
|
|
@ -13,12 +13,7 @@ namespace YooAsset.Editor
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
|
CreateReportFile(buildParameters, buildMapContext, manifestContext);
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
|
||||||
if (buildMode != EBuildMode.SimulateBuild)
|
|
||||||
{
|
|
||||||
CreateReportFile(buildParameters, buildMapContext, manifestContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,12 +7,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
|
EncryptingBundleFiles(buildParameters, buildMapContext);
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
|
||||||
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
|
||||||
{
|
|
||||||
EncryptingBundleFiles(buildParameters, buildMapContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@ namespace YooAsset.Editor
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = CreateBuildMap(buildParametersContext.Parameters);
|
var buildMapContext = CreateBuildMap(false, buildParametersContext.Parameters);
|
||||||
context.SetContextObject(buildMapContext);
|
context.SetContextObject(buildMapContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,42 @@ namespace YooAsset.Editor
|
||||||
// 检测基础构建参数
|
// 检测基础构建参数
|
||||||
buildParametersContext.CheckBuildParameters();
|
buildParametersContext.CheckBuildParameters();
|
||||||
|
|
||||||
|
// 检测是否有未保存场景
|
||||||
|
if (EditorTools.HasDirtyScenes())
|
||||||
|
{
|
||||||
|
string message = BuildLogger.GetErrorMessage(ErrorCode.FoundUnsavedScene, "Found unsaved scene !");
|
||||||
|
throw new Exception(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除包裹目录
|
||||||
|
if (buildParameters.ClearBuildCacheFiles)
|
||||||
|
{
|
||||||
|
string packageRootDirectory = buildParameters.GetPackageRootDirectory();
|
||||||
|
if (EditorTools.DeleteDirectory(packageRootDirectory))
|
||||||
|
{
|
||||||
|
BuildLogger.Log($"Delete package root directory: {packageRootDirectory}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测包裹输出目录是否存在
|
||||||
|
string packageOutputDirectory = buildParameters.GetPackageOutputDirectory();
|
||||||
|
if (Directory.Exists(packageOutputDirectory))
|
||||||
|
{
|
||||||
|
string message = BuildLogger.GetErrorMessage(ErrorCode.PackageOutputDirectoryExists, $"Package outout directory exists: {packageOutputDirectory}");
|
||||||
|
throw new Exception(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果输出目录不存在
|
||||||
|
string pipelineOutputDirectory = buildParameters.GetPipelineOutputDirectory();
|
||||||
|
if (EditorTools.CreateDirectory(pipelineOutputDirectory))
|
||||||
|
{
|
||||||
|
BuildLogger.Log($"Create pipeline output directory: {pipelineOutputDirectory}");
|
||||||
|
}
|
||||||
|
|
||||||
// 检测Unity版本
|
// 检测Unity版本
|
||||||
#if UNITY_2021_3_OR_NEWER
|
#if UNITY_2021_3_OR_NEWER
|
||||||
if (buildParameters.BuildMode != EBuildMode.SimulateBuild)
|
string warning = BuildLogger.GetErrorMessage(ErrorCode.RecommendScriptBuildPipeline, $"Starting with UnityEngine2021, recommend use script build pipeline (SBP) !");
|
||||||
{
|
BuildLogger.Warning(warning);
|
||||||
string warning = BuildLogger.GetErrorMessage(ErrorCode.RecommendScriptBuildPipeline, $"Starting with UnityEngine2021, recommend use script build pipeline (SBP) !");
|
|
||||||
BuildLogger.Warning(warning);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,77 +15,45 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
|
protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildResult = context.GetContextObject<TaskBuilding_BBP.BuildResultContext>();
|
||||||
var parameters = buildParametersContext.Parameters;
|
var hash = buildResult.UnityManifest.GetAssetBundleHash(bundleInfo.BundleName);
|
||||||
var buildMode = parameters.BuildMode;
|
if (hash.isValid)
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
{
|
{
|
||||||
return "00000000000000000000000000000000"; //32位
|
return hash.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var buildResult = context.GetContextObject<TaskBuilding_BBP.BuildResultContext>();
|
string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleHash, $"Not found unity bundle hash : {bundleInfo.BundleName}");
|
||||||
var hash = buildResult.UnityManifest.GetAssetBundleHash(bundleInfo.BundleName);
|
throw new Exception(message);
|
||||||
if (hash.isValid)
|
|
||||||
{
|
|
||||||
return hash.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleHash, $"Not found unity bundle hash : {bundleInfo.BundleName}");
|
|
||||||
throw new Exception(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
|
protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
string filePath = bundleInfo.BuildOutputFilePath;
|
||||||
var parameters = buildParametersContext.Parameters;
|
if (BuildPipeline.GetCRCForAssetBundle(filePath, out uint crc))
|
||||||
var buildMode = parameters.BuildMode;
|
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return crc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.BuildOutputFilePath;
|
string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleCRC, $"Not found unity bundle crc : {bundleInfo.BundleName}");
|
||||||
if (BuildPipeline.GetCRCForAssetBundle(filePath, out uint crc))
|
throw new Exception(message);
|
||||||
{
|
|
||||||
return crc;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleCRC, $"Not found unity bundle crc : {bundleInfo.BundleName}");
|
|
||||||
throw new Exception(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
return HashUtility.FileMD5(filePath);
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return GetFilePathTempHash(filePath);
|
|
||||||
else
|
|
||||||
return HashUtility.FileMD5(filePath);
|
|
||||||
}
|
}
|
||||||
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
return HashUtility.FileCRC32(filePath);
|
||||||
if ( buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return "00000000"; //8位
|
|
||||||
else
|
|
||||||
return HashUtility.FileCRC32(filePath);
|
|
||||||
}
|
}
|
||||||
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
return FileUtility.GetFileSize(filePath);
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return GetBundleTempSize(bundleInfo);
|
|
||||||
else
|
|
||||||
return FileUtility.GetFileSize(filePath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,10 +15,6 @@ namespace YooAsset.Editor
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildParameters = buildParametersContext.Parameters as BuiltinBuildParameters;
|
var buildParameters = buildParametersContext.Parameters as BuiltinBuildParameters;
|
||||||
|
|
||||||
// 模拟构建模式下跳过验证
|
|
||||||
if (buildParameters.BuildMode == EBuildMode.SimulateBuild)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// 验证构建结果
|
// 验证构建结果
|
||||||
if (buildParameters.VerifyBuildingResult)
|
if (buildParameters.VerifyBuildingResult)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace YooAsset.Editor
|
||||||
else if (CompressOption == ECompressOption.LZ4)
|
else if (CompressOption == ECompressOption.LZ4)
|
||||||
opt |= BuildAssetBundleOptions.ChunkBasedCompression;
|
opt |= BuildAssetBundleOptions.ChunkBasedCompression;
|
||||||
|
|
||||||
if (BuildMode == EBuildMode.ForceRebuild)
|
if (ClearBuildCacheFiles)
|
||||||
opt |= BuildAssetBundleOptions.ForceRebuildAssetBundle; //Force rebuild the asset bundles
|
opt |= BuildAssetBundleOptions.ForceRebuildAssetBundle; //Force rebuild the asset bundles
|
||||||
if (DisableWriteTypeTree)
|
if (DisableWriteTypeTree)
|
||||||
opt |= BuildAssetBundleOptions.DisableWriteTypeTree; //Do not include type information within the asset bundle (don't write type tree).
|
opt |= BuildAssetBundleOptions.DisableWriteTypeTree; //Do not include type information within the asset bundle (don't write type tree).
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 12f78ad22f0513c44b6037469dbd6363
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1138888cdba447345abb498b0c89affa
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class TaskCreateManifest_ESBP : TaskCreateManifest, IBuildTask
|
||||||
|
{
|
||||||
|
void IBuildTask.Run(BuildContext context)
|
||||||
|
{
|
||||||
|
CreateManifestFile(false, false, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
||||||
|
{
|
||||||
|
return Array.Empty<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 0b6f2523a865e454d8fa3f48a2852d5a
|
guid: 120e126cc10604c4f811c3b6377f7452
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class TaskGetBuildMap_ESBP : TaskGetBuildMap, IBuildTask
|
||||||
|
{
|
||||||
|
void IBuildTask.Run(BuildContext context)
|
||||||
|
{
|
||||||
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
|
var buildMapContext = CreateBuildMap(true, buildParametersContext.Parameters);
|
||||||
|
context.SetContextObject(buildMapContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: cbc12d398555ced46b201626eec6825e
|
guid: 789c337b5b82f1c438a588982dfca346
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class TaskPrepare_ESBP : IBuildTask
|
||||||
|
{
|
||||||
|
void IBuildTask.Run(BuildContext context)
|
||||||
|
{
|
||||||
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
|
var buildParameters = buildParametersContext.Parameters;
|
||||||
|
|
||||||
|
// 检测基础构建参数
|
||||||
|
buildParametersContext.CheckBuildParameters();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: abbe56a7120e34349b10f20956ed51a7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
using System.Text;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class TaskUpdateBundleInfo_ESBP : TaskUpdateBundleInfo, IBuildTask
|
||||||
|
{
|
||||||
|
void IBuildTask.Run(BuildContext context)
|
||||||
|
{
|
||||||
|
UpdateBundleInfo(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
|
||||||
|
{
|
||||||
|
return "00000000000000000000000000000000"; //32位
|
||||||
|
}
|
||||||
|
protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
|
{
|
||||||
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
|
return GetFilePathTempHash(filePath);
|
||||||
|
}
|
||||||
|
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
|
{
|
||||||
|
return "00000000"; //8位
|
||||||
|
}
|
||||||
|
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
|
{
|
||||||
|
return GetBundleTempSize(bundleInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetFilePathTempHash(string filePath)
|
||||||
|
{
|
||||||
|
byte[] bytes = Encoding.UTF8.GetBytes(filePath);
|
||||||
|
return HashUtility.BytesMD5(bytes);
|
||||||
|
|
||||||
|
// 注意:在文件路径的哈希值冲突的情况下,可以使用下面的方法
|
||||||
|
//return $"{HashUtility.BytesMD5(bytes)}-{Guid.NewGuid():N}";
|
||||||
|
}
|
||||||
|
private long GetBundleTempSize(BuildBundleInfo bundleInfo)
|
||||||
|
{
|
||||||
|
long tempSize = 0;
|
||||||
|
|
||||||
|
var assetPaths = bundleInfo.GetAllMainAssetPaths();
|
||||||
|
foreach (var assetPath in assetPaths)
|
||||||
|
{
|
||||||
|
long size = FileUtility.GetFileSize(assetPath);
|
||||||
|
tempSize += size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tempSize == 0)
|
||||||
|
{
|
||||||
|
string message = BuildLogger.GetErrorMessage(ErrorCode.BundleTempSizeIsZero, $"Bundle temp size is zero, check bundle main asset list : {bundleInfo.BundleName}");
|
||||||
|
throw new Exception(message);
|
||||||
|
}
|
||||||
|
return tempSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 990b41f647b80a34ab666a3b0c1ba3f6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class EditorSimulateBuildParameters : BuildParameters
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 03ea37371e6dc644cb2e6eabf9e7e2ad
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,37 @@
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
public class EditorSimulateBuildPipeline : IBuildPipeline
|
||||||
|
{
|
||||||
|
public BuildResult Run(BuildParameters buildParameters, bool enableLog)
|
||||||
|
{
|
||||||
|
if (buildParameters is EditorSimulateBuildParameters)
|
||||||
|
{
|
||||||
|
AssetBundleBuilder builder = new AssetBundleBuilder();
|
||||||
|
return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new Exception($"Invalid build parameter type : {buildParameters.GetType().Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取默认的构建流程
|
||||||
|
/// </summary>
|
||||||
|
private List<IBuildTask> GetDefaultBuildPipeline()
|
||||||
|
{
|
||||||
|
List<IBuildTask> pipeline = new List<IBuildTask>
|
||||||
|
{
|
||||||
|
new TaskPrepare_ESBP(),
|
||||||
|
new TaskGetBuildMap_ESBP(),
|
||||||
|
new TaskUpdateBundleInfo_ESBP(),
|
||||||
|
new TaskCreateManifest_ESBP()
|
||||||
|
};
|
||||||
|
return pipeline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9caf8e4846ad8b64eb04a4d5179942ff
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -10,14 +10,8 @@ namespace YooAsset.Editor
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
|
CopyRawBundle(buildMapContext, buildParametersContext);
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
|
||||||
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
|
||||||
{
|
|
||||||
CopyRawBundle(buildMapContext, buildParametersContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -13,13 +13,9 @@ namespace YooAsset.Editor
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildParameters = buildParametersContext.Parameters;
|
var buildParameters = buildParametersContext.Parameters;
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
|
if (buildParameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
||||||
if (buildParameters.BuildMode != EBuildMode.SimulateBuild)
|
|
||||||
{
|
{
|
||||||
if (buildParameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
||||||
{
|
|
||||||
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
CreateManifestFile(context);
|
CreateManifestFile(false, true, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
||||||
|
|
|
@ -9,17 +9,13 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
CreatePackagePatch(buildParameters, buildMapContext);
|
||||||
if (buildMode != EBuildMode.SimulateBuild)
|
|
||||||
{
|
|
||||||
CreatePackageCatalog(buildParameters, buildMapContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拷贝补丁文件到补丁包目录
|
/// 拷贝补丁文件到补丁包目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CreatePackageCatalog(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
|
private void CreatePackagePatch(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
|
||||||
{
|
{
|
||||||
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
||||||
BuildLogger.Log($"Start making patch package: {packageOutputDirectory}");
|
BuildLogger.Log($"Start making patch package: {packageOutputDirectory}");
|
||||||
|
|
|
@ -13,12 +13,7 @@ namespace YooAsset.Editor
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
|
CreateReportFile(buildParameters, buildMapContext, manifestContext);
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
|
||||||
if (buildMode != EBuildMode.SimulateBuild)
|
|
||||||
{
|
|
||||||
CreateReportFile(buildParameters, buildMapContext, manifestContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,12 +7,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
|
EncryptingBundleFiles(buildParameters, buildMapContext);
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
|
||||||
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
|
||||||
{
|
|
||||||
EncryptingBundleFiles(buildParameters, buildMapContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@ namespace YooAsset.Editor
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = CreateBuildMap(buildParametersContext.Parameters);
|
var buildMapContext = CreateBuildMap(true, buildParametersContext.Parameters);
|
||||||
context.SetContextObject(buildMapContext);
|
context.SetContextObject(buildMapContext);
|
||||||
|
|
||||||
// 检测构建结果
|
// 检测构建结果
|
||||||
|
|
|
@ -16,18 +16,29 @@ namespace YooAsset.Editor
|
||||||
// 检测基础构建参数
|
// 检测基础构建参数
|
||||||
buildParametersContext.CheckBuildParameters();
|
buildParametersContext.CheckBuildParameters();
|
||||||
|
|
||||||
// 检测不被支持的参数
|
// 删除包裹目录
|
||||||
if (buildParameters.EnableSharePackRule)
|
if (buildParameters.ClearBuildCacheFiles)
|
||||||
{
|
{
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportSharePackRule, $"{nameof(EBuildPipeline.RawFileBuildPipeline)} not support share pack rule !");
|
string packageRootDirectory = buildParameters.GetPackageRootDirectory();
|
||||||
|
if (EditorTools.DeleteDirectory(packageRootDirectory))
|
||||||
|
{
|
||||||
|
BuildLogger.Log($"Delete package root directory: {packageRootDirectory}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测包裹输出目录是否存在
|
||||||
|
string packageOutputDirectory = buildParameters.GetPackageOutputDirectory();
|
||||||
|
if (Directory.Exists(packageOutputDirectory))
|
||||||
|
{
|
||||||
|
string message = BuildLogger.GetErrorMessage(ErrorCode.PackageOutputDirectoryExists, $"Package outout directory exists: {packageOutputDirectory}");
|
||||||
throw new Exception(message);
|
throw new Exception(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测不被支持的构建模式
|
// 如果输出目录不存在
|
||||||
if (buildParameters.BuildMode == EBuildMode.IncrementalBuild)
|
string pipelineOutputDirectory = buildParameters.GetPipelineOutputDirectory();
|
||||||
|
if (EditorTools.CreateDirectory(pipelineOutputDirectory))
|
||||||
{
|
{
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.RawFileBuildPipeline)} not support {nameof(EBuildMode.IncrementalBuild)} build mode !");
|
BuildLogger.Log($"Create pipeline output directory: {pipelineOutputDirectory}");
|
||||||
throw new Exception(message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,18 +15,8 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
|
protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
var parameters = buildParametersContext.Parameters;
|
return HashUtility.FileMD5(filePath);
|
||||||
var buildMode = parameters.BuildMode;
|
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
{
|
|
||||||
return "00000000000000000000000000000000"; //32位
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
|
||||||
return HashUtility.FileMD5(filePath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
|
protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
|
||||||
{
|
{
|
||||||
|
@ -35,29 +25,17 @@ namespace YooAsset.Editor
|
||||||
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
return HashUtility.FileMD5(filePath);
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return GetFilePathTempHash(filePath);
|
|
||||||
else
|
|
||||||
return HashUtility.FileMD5(filePath);
|
|
||||||
}
|
}
|
||||||
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
return HashUtility.FileCRC32(filePath);
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return "00000000"; //8位
|
|
||||||
else
|
|
||||||
return HashUtility.FileCRC32(filePath);
|
|
||||||
}
|
}
|
||||||
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
return FileUtility.GetFileSize(filePath);
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return GetBundleTempSize(bundleInfo);
|
|
||||||
else
|
|
||||||
return FileUtility.GetFileSize(filePath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,11 +21,6 @@ namespace YooAsset.Editor
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
|
var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
|
||||||
|
|
||||||
// 模拟构建模式下跳过引擎构建
|
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// 构建内容
|
// 构建内容
|
||||||
var buildContent = new BundleBuildContent(buildMapContext.GetPipelineBuilds());
|
var buildContent = new BundleBuildContent(buildMapContext.GetPipelineBuilds());
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,9 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
||||||
|
|
||||||
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
|
||||||
{
|
{
|
||||||
if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
|
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
||||||
{
|
|
||||||
CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
CreateManifestFile(context);
|
CreateManifestFile(true, true, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
protected override string[] GetBundleDepends(BuildContext context, string bundleName)
|
||||||
|
|
|
@ -9,17 +9,13 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
CreatePackagePatch(buildParameters, buildMapContext);
|
||||||
if (buildMode != EBuildMode.SimulateBuild)
|
|
||||||
{
|
|
||||||
CreatePackageCatalog(buildParameters, buildMapContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 拷贝补丁文件到补丁包目录
|
/// 拷贝补丁文件到补丁包目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CreatePackageCatalog(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
|
private void CreatePackagePatch(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
|
||||||
{
|
{
|
||||||
var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
|
var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
|
||||||
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
|
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
|
||||||
|
|
|
@ -13,12 +13,7 @@ namespace YooAsset.Editor
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
var manifestContext = context.GetContextObject<ManifestContext>();
|
var manifestContext = context.GetContextObject<ManifestContext>();
|
||||||
|
CreateReportFile(buildParameters, buildMapContext, manifestContext);
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
|
||||||
if (buildMode != EBuildMode.SimulateBuild)
|
|
||||||
{
|
|
||||||
CreateReportFile(buildParameters, buildMapContext, manifestContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,12 +7,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
var buildParameters = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
|
EncryptingBundleFiles(buildParameters, buildMapContext);
|
||||||
var buildMode = buildParameters.Parameters.BuildMode;
|
|
||||||
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
|
|
||||||
{
|
|
||||||
EncryptingBundleFiles(buildParameters, buildMapContext);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@ namespace YooAsset.Editor
|
||||||
void IBuildTask.Run(BuildContext context)
|
void IBuildTask.Run(BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildMapContext = CreateBuildMap(buildParametersContext.Parameters);
|
var buildMapContext = CreateBuildMap(false, buildParametersContext.Parameters);
|
||||||
context.SetContextObject(buildMapContext);
|
context.SetContextObject(buildMapContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,40 @@ namespace YooAsset.Editor
|
||||||
// 检测基础构建参数
|
// 检测基础构建参数
|
||||||
buildParametersContext.CheckBuildParameters();
|
buildParametersContext.CheckBuildParameters();
|
||||||
|
|
||||||
// 检测不被支持的构建模式
|
// 检测是否有未保存场景
|
||||||
if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
|
if (EditorTools.HasDirtyScenes())
|
||||||
{
|
{
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.ForceRebuild)} build mode !");
|
string message = BuildLogger.GetErrorMessage(ErrorCode.FoundUnsavedScene, "Found unsaved scene !");
|
||||||
throw new Exception(message);
|
throw new Exception(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除包裹目录
|
||||||
|
if (buildParameters.ClearBuildCacheFiles)
|
||||||
|
{
|
||||||
|
// Deletes the build cache directory.
|
||||||
|
UnityEditor.Build.Pipeline.Utilities.BuildCache.PurgeCache(false);
|
||||||
|
|
||||||
|
string packageRootDirectory = buildParameters.GetPackageRootDirectory();
|
||||||
|
if (EditorTools.DeleteDirectory(packageRootDirectory))
|
||||||
|
{
|
||||||
|
BuildLogger.Log($"Delete package root directory: {packageRootDirectory}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检测包裹输出目录是否存在
|
||||||
|
string packageOutputDirectory = buildParameters.GetPackageOutputDirectory();
|
||||||
|
if (Directory.Exists(packageOutputDirectory))
|
||||||
|
{
|
||||||
|
string message = BuildLogger.GetErrorMessage(ErrorCode.PackageOutputDirectoryExists, $"Package outout directory exists: {packageOutputDirectory}");
|
||||||
|
throw new Exception(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果输出目录不存在
|
||||||
|
string pipelineOutputDirectory = buildParameters.GetPipelineOutputDirectory();
|
||||||
|
if (EditorTools.CreateDirectory(pipelineOutputDirectory))
|
||||||
|
{
|
||||||
|
BuildLogger.Log($"Create pipeline output directory: {pipelineOutputDirectory}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,77 +15,45 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
|
protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
// 注意:当资源包的依赖列表发生变化的时候,ContentHash也会发生变化!
|
||||||
var parameters = buildParametersContext.Parameters;
|
var buildResult = context.GetContextObject<TaskBuilding_SBP.BuildResultContext>();
|
||||||
var buildMode = parameters.BuildMode;
|
if (buildResult.Results.BundleInfos.TryGetValue(bundleInfo.BundleName, out var value))
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
{
|
{
|
||||||
return "00000000000000000000000000000000"; //32位
|
return value.Hash.ToString();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 注意:当资源包的依赖列表发生变化的时候,ContentHash也会发生变化!
|
string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleHash, $"Not found unity bundle hash : {bundleInfo.BundleName}");
|
||||||
var buildResult = context.GetContextObject<TaskBuilding_SBP.BuildResultContext>();
|
throw new Exception(message);
|
||||||
if (buildResult.Results.BundleInfos.TryGetValue(bundleInfo.BundleName, out var value))
|
|
||||||
{
|
|
||||||
return value.Hash.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleHash, $"Not found unity bundle hash : {bundleInfo.BundleName}");
|
|
||||||
throw new Exception(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
|
protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
|
||||||
{
|
{
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildResult = context.GetContextObject<TaskBuilding_SBP.BuildResultContext>();
|
||||||
var parameters = buildParametersContext.Parameters;
|
if (buildResult.Results.BundleInfos.TryGetValue(bundleInfo.BundleName, out var value))
|
||||||
var buildMode = parameters.BuildMode;
|
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
{
|
{
|
||||||
return 0;
|
return value.Crc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var buildResult = context.GetContextObject<TaskBuilding_SBP.BuildResultContext>();
|
string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleCRC, $"Not found unity bundle crc : {bundleInfo.BundleName}");
|
||||||
if (buildResult.Results.BundleInfos.TryGetValue(bundleInfo.BundleName, out var value))
|
throw new Exception(message);
|
||||||
{
|
|
||||||
return value.Crc;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleCRC, $"Not found unity bundle crc : {bundleInfo.BundleName}");
|
|
||||||
throw new Exception(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
return HashUtility.FileMD5(filePath);
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return GetFilePathTempHash(filePath);
|
|
||||||
else
|
|
||||||
return HashUtility.FileMD5(filePath);
|
|
||||||
}
|
}
|
||||||
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
return HashUtility.FileCRC32(filePath);
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return "00000000"; //8位
|
|
||||||
else
|
|
||||||
return HashUtility.FileCRC32(filePath);
|
|
||||||
}
|
}
|
||||||
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
|
||||||
{
|
{
|
||||||
string filePath = bundleInfo.PackageSourceFilePath;
|
string filePath = bundleInfo.PackageSourceFilePath;
|
||||||
var buildMode = buildParametersContext.Parameters.BuildMode;
|
return FileUtility.GetFileSize(filePath);
|
||||||
if (buildMode == EBuildMode.SimulateBuild)
|
|
||||||
return GetBundleTempSize(bundleInfo);
|
|
||||||
else
|
|
||||||
return FileUtility.GetFileSize(filePath);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,10 +16,6 @@ namespace YooAsset.Editor
|
||||||
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
|
||||||
var buildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
|
var buildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
|
||||||
|
|
||||||
// 模拟构建模式下跳过验证
|
|
||||||
if (buildParameters.BuildMode == EBuildMode.SimulateBuild)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// 验证构建结果
|
// 验证构建结果
|
||||||
if (buildParameters.VerifyBuildingResult)
|
if (buildParameters.VerifyBuildingResult)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,8 +13,6 @@ namespace YooAsset.Editor
|
||||||
BuildinFileRootIsNullOrEmpty = 114,
|
BuildinFileRootIsNullOrEmpty = 114,
|
||||||
PackageOutputDirectoryExists = 115,
|
PackageOutputDirectoryExists = 115,
|
||||||
RecommendScriptBuildPipeline = 130,
|
RecommendScriptBuildPipeline = 130,
|
||||||
BuildPipelineNotSupportBuildMode = 140,
|
|
||||||
BuildPipelineNotSupportSharePackRule = 141,
|
|
||||||
|
|
||||||
// TaskGetBuildMap
|
// TaskGetBuildMap
|
||||||
RemoveInvalidTags = 200,
|
RemoveInvalidTags = 200,
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 资源包流水线的构建模式
|
|
||||||
/// </summary>
|
|
||||||
public enum EBuildMode
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 强制重建模式
|
|
||||||
/// </summary>
|
|
||||||
ForceRebuild,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 增量构建模式
|
|
||||||
/// </summary>
|
|
||||||
IncrementalBuild,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 模拟构建模式
|
|
||||||
/// </summary>
|
|
||||||
SimulateBuild,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,6 +6,11 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum EBuildPipeline
|
public enum EBuildPipeline
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑器下的模拟构建管线(ESBP)
|
||||||
|
/// </summary>
|
||||||
|
EditorSimulateBuildPipeline,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 传统内置构建管线 (BBP)
|
/// 传统内置构建管线 (BBP)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace YooAsset.Editor
|
||||||
private EnumField _outputNameStyleField;
|
private EnumField _outputNameStyleField;
|
||||||
private EnumField _copyBuildinFileOptionField;
|
private EnumField _copyBuildinFileOptionField;
|
||||||
private TextField _copyBuildinFileTagsField;
|
private TextField _copyBuildinFileTagsField;
|
||||||
|
private Toggle _clearBuildCacheToggle;
|
||||||
|
|
||||||
public BuildPipelineViewerBase(string packageName, EBuildPipeline buildPipeline, BuildTarget buildTarget, VisualElement parent)
|
public BuildPipelineViewerBase(string packageName, EBuildPipeline buildPipeline, BuildTarget buildTarget, VisualElement parent)
|
||||||
{
|
{
|
||||||
|
@ -59,24 +60,6 @@ namespace YooAsset.Editor
|
||||||
_buildVersionField.style.width = StyleWidth;
|
_buildVersionField.style.width = StyleWidth;
|
||||||
_buildVersionField.SetValueWithoutNotify(GetDefaultPackageVersion());
|
_buildVersionField.SetValueWithoutNotify(GetDefaultPackageVersion());
|
||||||
|
|
||||||
// 构建模式
|
|
||||||
{
|
|
||||||
var buildModeContainer = Root.Q("BuildModeContainer");
|
|
||||||
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
|
||||||
var buildModeList = GetSupportBuildModes();
|
|
||||||
int defaultIndex = buildModeList.FindIndex(x => x.Equals(buildMode));
|
|
||||||
if (defaultIndex < 0)
|
|
||||||
defaultIndex = (int)(EBuildMode)buildModeList[0];
|
|
||||||
_buildModeField = new PopupField<Enum>(buildModeList, defaultIndex);
|
|
||||||
_buildModeField.label = "Build Mode";
|
|
||||||
_buildModeField.style.width = StyleWidth;
|
|
||||||
_buildModeField.RegisterValueChangedCallback(evt =>
|
|
||||||
{
|
|
||||||
AssetBundleBuilderSetting.SetPackageBuildMode(PackageName, BuildPipeline, (EBuildMode)_buildModeField.value);
|
|
||||||
});
|
|
||||||
buildModeContainer.Add(_buildModeField);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 加密方法
|
// 加密方法
|
||||||
{
|
{
|
||||||
var encryptionContainer = Root.Q("EncryptionContainer");
|
var encryptionContainer = Root.Q("EncryptionContainer");
|
||||||
|
@ -148,6 +131,15 @@ namespace YooAsset.Editor
|
||||||
AssetBundleBuilderSetting.SetPackageBuildinFileCopyParams(PackageName, BuildPipeline, _copyBuildinFileTagsField.value);
|
AssetBundleBuilderSetting.SetPackageBuildinFileCopyParams(PackageName, BuildPipeline, _copyBuildinFileTagsField.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 清理构建缓存
|
||||||
|
bool clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, BuildPipeline);
|
||||||
|
_clearBuildCacheToggle = Root.Q<Toggle>("ClearBuildCache");
|
||||||
|
_clearBuildCacheToggle.SetValueWithoutNotify(clearBuildCache);
|
||||||
|
_clearBuildCacheToggle.RegisterValueChangedCallback(evt =>
|
||||||
|
{
|
||||||
|
AssetBundleBuilderSetting.SetPackageClearBuildCache(PackageName, BuildPipeline, _clearBuildCacheToggle.value);
|
||||||
|
});
|
||||||
|
|
||||||
// 构建按钮
|
// 构建按钮
|
||||||
var buildButton = Root.Q<Button>("Build");
|
var buildButton = Root.Q<Button>("Build");
|
||||||
buildButton.clicked += BuildButton_clicked;
|
buildButton.clicked += BuildButton_clicked;
|
||||||
|
@ -160,8 +152,7 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
private void BuildButton_clicked()
|
private void BuildButton_clicked()
|
||||||
{
|
{
|
||||||
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
if (EditorUtility.DisplayDialog("提示", $"开始构建资源包[{PackageName}]!", "Yes", "No"))
|
||||||
if (EditorUtility.DisplayDialog("提示", $"通过构建模式【{buildMode}】来构建!", "Yes", "No"))
|
|
||||||
{
|
{
|
||||||
EditorTools.ClearUnityConsole();
|
EditorTools.ClearUnityConsole();
|
||||||
EditorApplication.delayCall += ExecuteBuild;
|
EditorApplication.delayCall += ExecuteBuild;
|
||||||
|
@ -177,11 +168,6 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract void ExecuteBuild();
|
protected abstract void ExecuteBuild();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取构建管线支持的构建模式集合
|
|
||||||
/// </summary>
|
|
||||||
protected abstract List<Enum> GetSupportBuildModes();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取构建版本
|
/// 获取构建版本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<ui:VisualElement name="BuildContainer">
|
<ui:VisualElement name="BuildContainer">
|
||||||
<ui:TextField picking-mode="Ignore" label="Build Output" name="BuildOutput" />
|
<ui:TextField picking-mode="Ignore" label="Build Output" name="BuildOutput" />
|
||||||
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
<ui:TextField picking-mode="Ignore" label="Build Version" name="BuildVersion" />
|
||||||
<ui:VisualElement name="BuildModeContainer" style="height: 24px;" />
|
<ui:Toggle label="Clear Build Cache" name="ClearBuildCache" />
|
||||||
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
|
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
|
||||||
<uie:EnumField label="Compression" value="Center" name="Compression" />
|
<uie:EnumField label="Compression" value="Center" name="Compression" />
|
||||||
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
|
<uie:EnumField label="File Name Style" value="Center" name="FileNameStyle" />
|
||||||
|
|
|
@ -22,18 +22,17 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteBuild()
|
protected override void ExecuteBuild()
|
||||||
{
|
{
|
||||||
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
||||||
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, BuildPipeline);
|
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, BuildPipeline);
|
||||||
|
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, BuildPipeline);
|
||||||
|
|
||||||
BuiltinBuildParameters buildParameters = new BuiltinBuildParameters();
|
BuiltinBuildParameters buildParameters = new BuiltinBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
buildParameters.BuildMode = buildMode;
|
|
||||||
buildParameters.PackageName = PackageName;
|
buildParameters.PackageName = PackageName;
|
||||||
buildParameters.PackageVersion = GetPackageVersion();
|
buildParameters.PackageVersion = GetPackageVersion();
|
||||||
buildParameters.EnableSharePackRule = true;
|
buildParameters.EnableSharePackRule = true;
|
||||||
|
@ -41,23 +40,15 @@ namespace YooAsset.Editor
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
|
||||||
buildParameters.CompressOption = compressOption;
|
buildParameters.CompressOption = compressOption;
|
||||||
|
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
||||||
|
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
||||||
|
|
||||||
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
if (buildResult.Success)
|
if (buildResult.Success)
|
||||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<Enum> GetSupportBuildModes()
|
|
||||||
{
|
|
||||||
List<Enum> buildModeList = new List<Enum>();
|
|
||||||
buildModeList.Add(EBuildMode.ForceRebuild);
|
|
||||||
buildModeList.Add(EBuildMode.IncrementalBuild);
|
|
||||||
buildModeList.Add(EBuildMode.SimulateBuild);
|
|
||||||
return buildModeList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -0,0 +1,66 @@
|
||||||
|
#if UNITY_2019_4_OR_NEWER
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor.UIElements;
|
||||||
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
internal class EditorSimulateBuildPipelineViewer : BuildPipelineViewerBase
|
||||||
|
{
|
||||||
|
public EditorSimulateBuildPipelineViewer(string packageName, BuildTarget buildTarget, VisualElement parent)
|
||||||
|
: base(packageName, EBuildPipeline.RawFileBuildPipeline, buildTarget, parent)
|
||||||
|
{
|
||||||
|
var compressionField = Root.Q<EnumField>("Compression");
|
||||||
|
UIElementsTools.SetElementVisible(compressionField, false);
|
||||||
|
|
||||||
|
var encryptionContainer = Root.Q<VisualElement>("EncryptionContainer");
|
||||||
|
UIElementsTools.SetElementVisible(encryptionContainer, false);
|
||||||
|
|
||||||
|
var fileNameStyleField = Root.Q<EnumField>("FileNameStyle");
|
||||||
|
UIElementsTools.SetElementVisible(fileNameStyleField, false);
|
||||||
|
|
||||||
|
var copyBuildinFileOptionField = Root.Q<EnumField>("CopyBuildinFileOption");
|
||||||
|
UIElementsTools.SetElementVisible(copyBuildinFileOptionField, false);
|
||||||
|
|
||||||
|
var copyBuildinFileParamField = Root.Q<TextField>("CopyBuildinFileParam");
|
||||||
|
UIElementsTools.SetElementVisible(copyBuildinFileParamField, false);
|
||||||
|
|
||||||
|
var clearBuildCacheToggle = Root.Q<Toggle>("ClearBuildCache");
|
||||||
|
UIElementsTools.SetElementVisible(clearBuildCacheToggle, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 执行构建
|
||||||
|
/// </summary>
|
||||||
|
protected override void ExecuteBuild()
|
||||||
|
{
|
||||||
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
||||||
|
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
||||||
|
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
||||||
|
|
||||||
|
EditorSimulateBuildParameters buildParameters = new EditorSimulateBuildParameters();
|
||||||
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
|
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
|
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
||||||
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
|
buildParameters.PackageName = PackageName;
|
||||||
|
buildParameters.PackageVersion = GetPackageVersion();
|
||||||
|
buildParameters.VerifyBuildingResult = true;
|
||||||
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
|
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
||||||
|
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
||||||
|
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
||||||
|
|
||||||
|
EditorSimulateBuildPipeline pipeline = new EditorSimulateBuildPipeline();
|
||||||
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
|
if (buildResult.Success)
|
||||||
|
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 01e426f05b237b340881910d779e4c2e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -24,23 +24,23 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteBuild()
|
protected override void ExecuteBuild()
|
||||||
{
|
{
|
||||||
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
||||||
|
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, BuildPipeline);
|
||||||
|
|
||||||
RawFileBuildParameters buildParameters = new RawFileBuildParameters();
|
RawFileBuildParameters buildParameters = new RawFileBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
buildParameters.BuildMode = buildMode;
|
|
||||||
buildParameters.PackageName = PackageName;
|
buildParameters.PackageName = PackageName;
|
||||||
buildParameters.PackageVersion = GetPackageVersion();
|
buildParameters.PackageVersion = GetPackageVersion();
|
||||||
buildParameters.VerifyBuildingResult = true;
|
buildParameters.VerifyBuildingResult = true;
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
||||||
|
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
||||||
|
|
||||||
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
|
||||||
|
@ -48,14 +48,6 @@ namespace YooAsset.Editor
|
||||||
if (buildResult.Success)
|
if (buildResult.Success)
|
||||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<Enum> GetSupportBuildModes()
|
|
||||||
{
|
|
||||||
List<Enum> buildModeList = new List<Enum>();
|
|
||||||
buildModeList.Add(EBuildMode.ForceRebuild);
|
|
||||||
buildModeList.Add(EBuildMode.SimulateBuild);
|
|
||||||
return buildModeList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -22,18 +22,17 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void ExecuteBuild()
|
protected override void ExecuteBuild()
|
||||||
{
|
{
|
||||||
var buildMode = AssetBundleBuilderSetting.GetPackageBuildMode(PackageName, BuildPipeline);
|
|
||||||
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
var fileNameStyle = AssetBundleBuilderSetting.GetPackageFileNameStyle(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
var buildinFileCopyOption = AssetBundleBuilderSetting.GetPackageBuildinFileCopyOption(PackageName, BuildPipeline);
|
||||||
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
var buildinFileCopyParams = AssetBundleBuilderSetting.GetPackageBuildinFileCopyParams(PackageName, BuildPipeline);
|
||||||
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, BuildPipeline);
|
var compressOption = AssetBundleBuilderSetting.GetPackageCompressOption(PackageName, BuildPipeline);
|
||||||
|
var clearBuildCache = AssetBundleBuilderSetting.GetPackageClearBuildCache(PackageName, BuildPipeline);
|
||||||
|
|
||||||
ScriptableBuildParameters buildParameters = new ScriptableBuildParameters();
|
ScriptableBuildParameters buildParameters = new ScriptableBuildParameters();
|
||||||
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
|
||||||
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
buildParameters.BuildPipeline = BuildPipeline.ToString();
|
||||||
buildParameters.BuildTarget = BuildTarget;
|
buildParameters.BuildTarget = BuildTarget;
|
||||||
buildParameters.BuildMode = buildMode;
|
|
||||||
buildParameters.PackageName = PackageName;
|
buildParameters.PackageName = PackageName;
|
||||||
buildParameters.PackageVersion = GetPackageVersion();
|
buildParameters.PackageVersion = GetPackageVersion();
|
||||||
buildParameters.EnableSharePackRule = true;
|
buildParameters.EnableSharePackRule = true;
|
||||||
|
@ -41,22 +40,15 @@ namespace YooAsset.Editor
|
||||||
buildParameters.FileNameStyle = fileNameStyle;
|
buildParameters.FileNameStyle = fileNameStyle;
|
||||||
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
buildParameters.BuildinFileCopyOption = buildinFileCopyOption;
|
||||||
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
buildParameters.BuildinFileCopyParams = buildinFileCopyParams;
|
||||||
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
|
||||||
buildParameters.CompressOption = compressOption;
|
buildParameters.CompressOption = compressOption;
|
||||||
|
buildParameters.ClearBuildCacheFiles = clearBuildCache;
|
||||||
|
buildParameters.EncryptionServices = CreateEncryptionInstance();
|
||||||
|
|
||||||
ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
|
ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
|
||||||
var buildResult = pipeline.Run(buildParameters, true);
|
var buildResult = pipeline.Run(buildParameters, true);
|
||||||
if (buildResult.Success)
|
if (buildResult.Success)
|
||||||
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
EditorUtility.RevealInFinder(buildResult.OutputPackageDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override List<Enum> GetSupportBuildModes()
|
|
||||||
{
|
|
||||||
List<Enum> buildModeList = new List<Enum>();
|
|
||||||
buildModeList.Add(EBuildMode.IncrementalBuild);
|
|
||||||
buildModeList.Add(EBuildMode.SimulateBuild);
|
|
||||||
return buildModeList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -140,7 +140,7 @@ namespace YooAsset.Editor
|
||||||
public List<CollectAssetInfo> GetAllCollectAssets(CollectCommand command, AssetBundleCollectorGroup group)
|
public List<CollectAssetInfo> GetAllCollectAssets(CollectCommand command, AssetBundleCollectorGroup group)
|
||||||
{
|
{
|
||||||
// 注意:模拟构建模式下只收集主资源
|
// 注意:模拟构建模式下只收集主资源
|
||||||
if (command.BuildMode == EBuildMode.SimulateBuild)
|
if (command.SimulateBuild)
|
||||||
{
|
{
|
||||||
if (CollectorType != ECollectorType.MainAssetCollector)
|
if (CollectorType != ECollectorType.MainAssetCollector)
|
||||||
return new List<CollectAssetInfo>();
|
return new List<CollectAssetInfo>();
|
||||||
|
@ -149,7 +149,7 @@ namespace YooAsset.Editor
|
||||||
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(1000);
|
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(1000);
|
||||||
|
|
||||||
// 收集打包资源路径
|
// 收集打包资源路径
|
||||||
List<string> findAssets =new List<string>();
|
List<string> findAssets = new List<string>();
|
||||||
if (AssetDatabase.IsValidFolder(CollectPath))
|
if (AssetDatabase.IsValidFolder(CollectPath))
|
||||||
{
|
{
|
||||||
string collectDirectory = CollectPath;
|
string collectDirectory = CollectPath;
|
||||||
|
@ -220,7 +220,7 @@ namespace YooAsset.Editor
|
||||||
CollectAssetInfo collectAssetInfo = new CollectAssetInfo(CollectorType, bundleName, address, assetInfo, assetTags);
|
CollectAssetInfo collectAssetInfo = new CollectAssetInfo(CollectorType, bundleName, address, assetInfo, assetTags);
|
||||||
|
|
||||||
// 注意:模拟构建模式下不需要收集依赖资源
|
// 注意:模拟构建模式下不需要收集依赖资源
|
||||||
if (command.BuildMode == EBuildMode.SimulateBuild)
|
if (command.SimulateBuild)
|
||||||
collectAssetInfo.DependAssets = new List<AssetInfo>();
|
collectAssetInfo.DependAssets = new List<AssetInfo>();
|
||||||
else
|
else
|
||||||
collectAssetInfo.DependAssets = GetAllDependencies(command, assetInfo.AssetPath);
|
collectAssetInfo.DependAssets = GetAllDependencies(command, assetInfo.AssetPath);
|
||||||
|
@ -272,19 +272,43 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
private List<AssetInfo> GetAllDependencies(CollectCommand command, string mainAssetPath)
|
private List<AssetInfo> GetAllDependencies(CollectCommand command, string mainAssetPath)
|
||||||
{
|
{
|
||||||
string[] depends = AssetDatabase.GetDependencies(mainAssetPath, true);
|
List<AssetInfo> dependencies = new List<AssetInfo>();
|
||||||
List<AssetInfo> result = new List<AssetInfo>(depends.Length);
|
HashSet<AssetStamp> m_AssetStamps = new HashSet<AssetStamp>();
|
||||||
foreach (string assetPath in depends)
|
void GetDependRecursive(string assetPath)
|
||||||
{
|
{
|
||||||
// 注意:排除主资源对象
|
string[] depends = AssetDatabase.GetDependencies(assetPath, false);
|
||||||
if (assetPath == mainAssetPath)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
AssetInfo assetInfo = new AssetInfo(assetPath);
|
foreach (string dependPath in depends)
|
||||||
if (command.IgnoreRule.IsIgnore(assetInfo) == false)
|
{
|
||||||
result.Add(assetInfo);
|
// 注意:排除资源自身
|
||||||
|
if (dependPath == assetPath)
|
||||||
|
continue;
|
||||||
|
//排除主资源
|
||||||
|
if (dependPath == mainAssetPath)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var stamp = new AssetStamp(mainAssetPath, dependPath);
|
||||||
|
|
||||||
|
//主资源对于一个资源只有一个依赖
|
||||||
|
if (m_AssetStamps.Contains(stamp))
|
||||||
|
continue;
|
||||||
|
m_AssetStamps.Add(stamp);
|
||||||
|
|
||||||
|
AssetInfo assetInfo = new AssetInfo(dependPath);
|
||||||
|
|
||||||
|
//根据忽略规则排除
|
||||||
|
if (command.IgnoreRule.IsIgnore(assetInfo))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
dependencies.Add(assetInfo);
|
||||||
|
|
||||||
|
GetDependRecursive(dependPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
|
GetDependRecursive(mainAssetPath);
|
||||||
|
|
||||||
|
return dependencies;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
// 检测分组是否激活
|
// 检测分组是否激活
|
||||||
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(ActiveRuleName);
|
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(ActiveRuleName);
|
||||||
if (activeRule.IsActiveGroup() == false)
|
if (activeRule.IsActiveGroup(new GroupData(GroupName)) == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var collector in Collectors)
|
foreach (var collector in Collectors)
|
||||||
|
@ -80,7 +80,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
// 检测分组是否激活
|
// 检测分组是否激活
|
||||||
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(ActiveRuleName);
|
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(ActiveRuleName);
|
||||||
if (activeRule.IsActiveGroup() == false)
|
if (activeRule.IsActiveGroup(new GroupData(GroupName)) == false)
|
||||||
{
|
{
|
||||||
return new List<CollectAssetInfo>();
|
return new List<CollectAssetInfo>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取包裹收集的资源文件
|
/// 获取包裹收集的资源文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CollectResult GetPackageAssets(EBuildMode buildMode, string packageName)
|
public CollectResult GetPackageAssets(bool simulateBuild, string packageName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(packageName))
|
if (string.IsNullOrEmpty(packageName))
|
||||||
throw new Exception("Build package name is null or empty !");
|
throw new Exception("Build package name is null or empty !");
|
||||||
|
@ -100,7 +100,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
// 创建资源收集命令
|
// 创建资源收集命令
|
||||||
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(package.IgnoreRuleName);
|
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(package.IgnoreRuleName);
|
||||||
CollectCommand command = new CollectCommand(buildMode, packageName,
|
CollectCommand command = new CollectCommand(simulateBuild, packageName,
|
||||||
package.EnableAddressable,
|
package.EnableAddressable,
|
||||||
package.LocationToLower,
|
package.LocationToLower,
|
||||||
package.IncludeAssetGUID,
|
package.IncludeAssetGUID,
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace YooAsset.Editor
|
||||||
private Toggle _includeAssetGUIDToogle;
|
private Toggle _includeAssetGUIDToogle;
|
||||||
private Toggle _autoCollectShadersToogle;
|
private Toggle _autoCollectShadersToogle;
|
||||||
private PopupField<RuleDisplayName> _ignoreRulePopupField;
|
private PopupField<RuleDisplayName> _ignoreRulePopupField;
|
||||||
|
|
||||||
private VisualElement _packageContainer;
|
private VisualElement _packageContainer;
|
||||||
private ListView _packageListView;
|
private ListView _packageListView;
|
||||||
private TextField _packageNameTxt;
|
private TextField _packageNameTxt;
|
||||||
|
@ -172,10 +172,10 @@ namespace YooAsset.Editor
|
||||||
_ignoreRulePopupField.style.width = 300;
|
_ignoreRulePopupField.style.width = 300;
|
||||||
_ignoreRulePopupField.formatListItemCallback = FormatListItemCallback;
|
_ignoreRulePopupField.formatListItemCallback = FormatListItemCallback;
|
||||||
_ignoreRulePopupField.formatSelectedValueCallback = FormatSelectedValueCallback;
|
_ignoreRulePopupField.formatSelectedValueCallback = FormatSelectedValueCallback;
|
||||||
_ignoreRulePopupField.RegisterValueChangedCallback(evt =>
|
_ignoreRulePopupField.RegisterValueChangedCallback(evt =>
|
||||||
{
|
{
|
||||||
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
|
var selectPackage = _packageListView.selectedItem as AssetBundleCollectorPackage;
|
||||||
if(selectPackage != null)
|
if (selectPackage != null)
|
||||||
{
|
{
|
||||||
selectPackage.IgnoreRuleName = evt.newValue.ClassName;
|
selectPackage.IgnoreRuleName = evt.newValue.ClassName;
|
||||||
AssetBundleCollectorSettingData.ModifyPackage(selectPackage);
|
AssetBundleCollectorSettingData.ModifyPackage(selectPackage);
|
||||||
|
@ -657,7 +657,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
// 激活状态
|
// 激活状态
|
||||||
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(group.ActiveRuleName);
|
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(group.ActiveRuleName);
|
||||||
bool isActive = activeRule.IsActiveGroup();
|
bool isActive = activeRule.IsActiveGroup(new GroupData(group.GroupName));
|
||||||
textField1.SetEnabled(isActive);
|
textField1.SetEnabled(isActive);
|
||||||
}
|
}
|
||||||
private void GroupListView_onSelectionChange(IEnumerable<object> objs)
|
private void GroupListView_onSelectionChange(IEnumerable<object> objs)
|
||||||
|
@ -991,7 +991,7 @@ namespace YooAsset.Editor
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(_ignoreRulePopupField.value.ClassName);
|
IIgnoreRule ignoreRule = AssetBundleCollectorSettingData.GetIgnoreRuleInstance(_ignoreRulePopupField.value.ClassName);
|
||||||
CollectCommand command = new CollectCommand(EBuildMode.SimulateBuild,
|
CollectCommand command = new CollectCommand(true,
|
||||||
_packageNameTxt.value,
|
_packageNameTxt.value,
|
||||||
_enableAddressableToogle.value,
|
_enableAddressableToogle.value,
|
||||||
_locationToLowerToogle.value,
|
_locationToLowerToogle.value,
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace YooAsset.Editor
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Auto)]
|
||||||
|
internal struct AssetStamp
|
||||||
|
{
|
||||||
|
private readonly string m_AssetName;
|
||||||
|
private readonly string m_DependAssetPath;
|
||||||
|
|
||||||
|
public AssetStamp(string assetName, string dependencyAssetName)
|
||||||
|
{
|
||||||
|
m_AssetName = assetName;
|
||||||
|
m_DependAssetPath = dependencyAssetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string AssetName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_AssetName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DependAssetPath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_DependAssetPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,9 +4,9 @@ namespace YooAsset.Editor
|
||||||
public class CollectCommand
|
public class CollectCommand
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建模式
|
/// 模拟构建模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EBuildMode BuildMode { private set; get; }
|
public bool SimulateBuild { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 包裹名称
|
/// 包裹名称
|
||||||
|
@ -49,11 +49,11 @@ namespace YooAsset.Editor
|
||||||
public IIgnoreRule IgnoreRule { private set; get; }
|
public IIgnoreRule IgnoreRule { private set; get; }
|
||||||
|
|
||||||
|
|
||||||
public CollectCommand(EBuildMode buildMode, string packageName,
|
public CollectCommand(bool simulateBuild, string packageName,
|
||||||
bool enableAddressable, bool locationToLower, bool includeAssetGUID,
|
bool enableAddressable, bool locationToLower, bool includeAssetGUID,
|
||||||
bool autoCollectShaders, bool uniqueBundleName, IIgnoreRule ignoreRule)
|
bool autoCollectShaders, bool uniqueBundleName, IIgnoreRule ignoreRule)
|
||||||
{
|
{
|
||||||
BuildMode = buildMode;
|
SimulateBuild = simulateBuild;
|
||||||
PackageName = packageName;
|
PackageName = packageName;
|
||||||
EnableAddressable = enableAddressable;
|
EnableAddressable = enableAddressable;
|
||||||
LocationToLower = locationToLower;
|
LocationToLower = locationToLower;
|
||||||
|
|
|
@ -1,6 +1,16 @@
|
||||||
|
|
||||||
namespace YooAsset.Editor
|
namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
|
public struct GroupData
|
||||||
|
{
|
||||||
|
public string GroupName;
|
||||||
|
|
||||||
|
public GroupData(string groupName)
|
||||||
|
{
|
||||||
|
GroupName = groupName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源分组激活规则接口
|
/// 资源分组激活规则接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -9,6 +19,6 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否激活分组
|
/// 是否激活分组
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsActiveGroup();
|
bool IsActiveGroup(GroupData data);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ namespace YooAsset.Editor
|
||||||
[DisplayName("启用分组")]
|
[DisplayName("启用分组")]
|
||||||
public class EnableGroup : IActiveRule
|
public class EnableGroup : IActiveRule
|
||||||
{
|
{
|
||||||
public bool IsActiveGroup()
|
public bool IsActiveGroup(GroupData data)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace YooAsset.Editor
|
||||||
[DisplayName("禁用分组")]
|
[DisplayName("禁用分组")]
|
||||||
public class DisableGroup : IActiveRule
|
public class DisableGroup : IActiveRule
|
||||||
{
|
{
|
||||||
public bool IsActiveGroup()
|
public bool IsActiveGroup(GroupData data)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,6 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BuildTarget BuildTarget;
|
public BuildTarget BuildTarget;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 构建模式
|
|
||||||
/// </summary>
|
|
||||||
public EBuildMode BuildMode;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建管线
|
/// 构建管线
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -67,6 +62,7 @@ namespace YooAsset.Editor
|
||||||
public string IgnoreRuleName;
|
public string IgnoreRuleName;
|
||||||
|
|
||||||
// 构建参数
|
// 构建参数
|
||||||
|
public bool ClearBuildCacheFiles;
|
||||||
public bool EnableSharePackRule;
|
public bool EnableSharePackRule;
|
||||||
public string EncryptionClassName;
|
public string EncryptionClassName;
|
||||||
public EFileNameStyle FileNameStyle;
|
public EFileNameStyle FileNameStyle;
|
||||||
|
|
|
@ -62,7 +62,6 @@ namespace YooAsset.Editor
|
||||||
_items.Add(new ItemWrapper("Build Seconds", ConvertTime(buildReport.Summary.BuildSeconds)));
|
_items.Add(new ItemWrapper("Build Seconds", ConvertTime(buildReport.Summary.BuildSeconds)));
|
||||||
_items.Add(new ItemWrapper("Build Target", $"{buildReport.Summary.BuildTarget}"));
|
_items.Add(new ItemWrapper("Build Target", $"{buildReport.Summary.BuildTarget}"));
|
||||||
_items.Add(new ItemWrapper("Build Pipeline", $"{buildReport.Summary.BuildPipeline}"));
|
_items.Add(new ItemWrapper("Build Pipeline", $"{buildReport.Summary.BuildPipeline}"));
|
||||||
_items.Add(new ItemWrapper("Build Mode", $"{buildReport.Summary.BuildMode}"));
|
|
||||||
_items.Add(new ItemWrapper("Package Name", buildReport.Summary.BuildPackageName));
|
_items.Add(new ItemWrapper("Package Name", buildReport.Summary.BuildPackageName));
|
||||||
_items.Add(new ItemWrapper("Package Version", buildReport.Summary.BuildPackageVersion));
|
_items.Add(new ItemWrapper("Package Version", buildReport.Summary.BuildPackageVersion));
|
||||||
_items.Add(new ItemWrapper("Package Note", buildReport.Summary.BuildPackageNote));
|
_items.Add(new ItemWrapper("Package Note", buildReport.Summary.BuildPackageNote));
|
||||||
|
@ -78,6 +77,7 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
_items.Add(new ItemWrapper(string.Empty, string.Empty));
|
||||||
_items.Add(new ItemWrapper("Build Params", string.Empty));
|
_items.Add(new ItemWrapper("Build Params", string.Empty));
|
||||||
|
_items.Add(new ItemWrapper("Clear Build Cache Files", $"{buildReport.Summary.ClearBuildCacheFiles}"));
|
||||||
_items.Add(new ItemWrapper("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}"));
|
_items.Add(new ItemWrapper("Enable Share Pack Rule", $"{buildReport.Summary.EnableSharePackRule}"));
|
||||||
_items.Add(new ItemWrapper("Encryption Class Name", buildReport.Summary.EncryptionClassName));
|
_items.Add(new ItemWrapper("Encryption Class Name", buildReport.Summary.EncryptionClassName));
|
||||||
_items.Add(new ItemWrapper("FileNameStyle", $"{buildReport.Summary.FileNameStyle}"));
|
_items.Add(new ItemWrapper("FileNameStyle", $"{buildReport.Summary.FileNameStyle}"));
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace YooAsset
|
|
||||||
{
|
|
||||||
internal class CacheHelper
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 获取默认的缓存根目录
|
|
||||||
/// </summary>
|
|
||||||
public static string GetDefaultCacheRoot()
|
|
||||||
{
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
// 注意:为了方便调试查看,编辑器下把存储目录放到项目里。
|
|
||||||
string projectPath = Path.GetDirectoryName(UnityEngine.Application.dataPath);
|
|
||||||
projectPath = PathUtility.RegularPath(projectPath);
|
|
||||||
return PathUtility.Combine(projectPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
|
||||||
#elif UNITY_STANDALONE
|
|
||||||
return PathUtility.Combine(UnityEngine.Application.dataPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
|
||||||
#else
|
|
||||||
return PathUtility.Combine(UnityEngine.Application.persistentDataPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -181,7 +181,7 @@ namespace YooAsset
|
||||||
PackageName = packageName;
|
PackageName = packageName;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(rootDirectory))
|
if (string.IsNullOrEmpty(rootDirectory))
|
||||||
rootDirectory = GetDefaultRoot();
|
rootDirectory = GetDefaultBuildinRoot();
|
||||||
|
|
||||||
_packageRoot = PathUtility.Combine(rootDirectory, packageName);
|
_packageRoot = PathUtility.Combine(rootDirectory, packageName);
|
||||||
|
|
||||||
|
@ -292,9 +292,9 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 内部方法
|
#region 内部方法
|
||||||
protected string GetDefaultRoot()
|
protected string GetDefaultBuildinRoot()
|
||||||
{
|
{
|
||||||
return PathUtility.Combine(Application.streamingAssetsPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
return YooAssetSettingsData.GetYooMobileBuildinRoot();
|
||||||
}
|
}
|
||||||
public string GetBuildinFileLoadPath(PackageBundle bundle)
|
public string GetBuildinFileLoadPath(PackageBundle bundle)
|
||||||
{
|
{
|
||||||
|
@ -305,30 +305,25 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
public string GetBuildinCatalogFileLoadPath()
|
|
||||||
{
|
|
||||||
string fileName = Path.GetFileNameWithoutExtension(DefaultBuildinFileSystemDefine.BuildinCatalogFileName);
|
|
||||||
return PathUtility.Combine(YooAssetSettingsData.Setting.DefaultYooFolderName, PackageName, fileName);
|
|
||||||
}
|
|
||||||
public string GetBuildinPackageVersionFilePath()
|
public string GetBuildinPackageVersionFilePath()
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(PackageName);
|
string fileName = YooAssetSettingsData.GetPackageVersionFileName(PackageName);
|
||||||
return PathUtility.Combine(FileRoot, fileName);
|
return PathUtility.Combine(_packageRoot, fileName);
|
||||||
}
|
}
|
||||||
public string GetBuildinPackageHashFilePath(string packageVersion)
|
public string GetBuildinPackageHashFilePath(string packageVersion)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageHashFileName(PackageName, packageVersion);
|
string fileName = YooAssetSettingsData.GetPackageHashFileName(PackageName, packageVersion);
|
||||||
return PathUtility.Combine(FileRoot, fileName);
|
return PathUtility.Combine(_packageRoot, fileName);
|
||||||
}
|
}
|
||||||
public string GetBuildinPackageManifestFilePath(string packageVersion)
|
public string GetBuildinPackageManifestFilePath(string packageVersion)
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
|
||||||
return PathUtility.Combine(FileRoot, fileName);
|
return PathUtility.Combine(_packageRoot, fileName);
|
||||||
}
|
}
|
||||||
public string GetStreamingAssetsPackageRoot()
|
public string GetCatalogFileLoadPath()
|
||||||
{
|
{
|
||||||
string rootPath = PathUtility.Combine(Application.dataPath, "StreamingAssets", YooAssetSettingsData.Setting.DefaultYooFolderName);
|
string fileName = Path.GetFileNameWithoutExtension(DefaultBuildinFileSystemDefine.BuildinCatalogFileName);
|
||||||
return PathUtility.Combine(rootPath, PackageName);
|
return YooAssetSettingsData.GetYooResourcesLoadPath(PackageName, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -17,12 +17,12 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
YooLogger.Log("Begin to create catalog file !");
|
YooLogger.Log("Begin to create catalog file !");
|
||||||
|
|
||||||
string savePath = $"Assets/Resources/{YooAssetSettingsData.Setting.DefaultYooFolderName}";
|
string savePath = YooAssetSettingsData.GetYooResourcesFullPath();
|
||||||
DirectoryInfo saveDirectory = new DirectoryInfo(savePath);
|
DirectoryInfo saveDirectory = new DirectoryInfo(savePath);
|
||||||
if (saveDirectory.Exists)
|
if (saveDirectory.Exists)
|
||||||
saveDirectory.Delete(true);
|
saveDirectory.Delete(true);
|
||||||
|
|
||||||
string rootPath = $"{Application.dataPath}/StreamingAssets/{YooAssetSettingsData.Setting.DefaultYooFolderName}";
|
string rootPath = YooAssetSettingsData.GetYooEditorBuildinRoot();
|
||||||
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
|
||||||
if (rootDirectory.Exists == false)
|
if (rootDirectory.Exists == false)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,8 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string saveFilePath = $"Assets/Resources/{YooAssetSettingsData.Setting.DefaultYooFolderName}/{packageName}/{DefaultBuildinFileSystemDefine.BuildinCatalogFileName}";
|
string fullPath = YooAssetSettingsData.GetYooResourcesFullPath();
|
||||||
|
string saveFilePath = $"{fullPath}/{packageName}/{DefaultBuildinFileSystemDefine.BuildinCatalogFileName}";
|
||||||
FileUtility.CreateFileDirectory(saveFilePath);
|
FileUtility.CreateFileDirectory(saveFilePath);
|
||||||
|
|
||||||
UnityEditor.AssetDatabase.CreateAsset(buildinFileCatalog, saveFilePath);
|
UnityEditor.AssetDatabase.CreateAsset(buildinFileCatalog, saveFilePath);
|
||||||
|
|
|
@ -65,7 +65,8 @@ namespace YooAsset
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
// 兼容性初始化
|
// 兼容性初始化
|
||||||
// 说明:内置文件系统在编辑器下运行时需要动态生成
|
// 说明:内置文件系统在编辑器下运行时需要动态生成
|
||||||
string packageRoot = _fileSystem.GetStreamingAssetsPackageRoot();
|
string buildinRoot = YooAssetSettingsData.GetYooEditorBuildinRoot();
|
||||||
|
string packageRoot = PathUtility.Combine(buildinRoot, _fileSystem.PackageName);
|
||||||
DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(_fileSystem.PackageName, packageRoot);
|
DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(_fileSystem.PackageName, packageRoot);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace YooAsset
|
||||||
|
|
||||||
if (_steps == ESteps.LoadCatalog)
|
if (_steps == ESteps.LoadCatalog)
|
||||||
{
|
{
|
||||||
string catalogFilePath = _fileSystem.GetBuildinCatalogFileLoadPath();
|
string catalogFilePath = _fileSystem.GetCatalogFileLoadPath();
|
||||||
var catalog = Resources.Load<DefaultBuildinFileCatalog>(catalogFilePath);
|
var catalog = Resources.Load<DefaultBuildinFileCatalog>(catalogFilePath);
|
||||||
if (catalog == null)
|
if (catalog == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -255,7 +255,7 @@ namespace YooAsset
|
||||||
PackageName = packageName;
|
PackageName = packageName;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(rootDirectory))
|
if (string.IsNullOrEmpty(rootDirectory))
|
||||||
rootDirectory = CacheHelper.GetDefaultCacheRoot();
|
rootDirectory = GetDefaultCacheRoot();
|
||||||
|
|
||||||
_packageRoot = PathUtility.Combine(rootDirectory, packageName);
|
_packageRoot = PathUtility.Combine(rootDirectory, packageName);
|
||||||
_cacheFileRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.SaveFilesFolderName);
|
_cacheFileRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.SaveFilesFolderName);
|
||||||
|
@ -520,6 +520,16 @@ namespace YooAsset
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 内部方法
|
#region 内部方法
|
||||||
|
public string GetDefaultCacheRoot()
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
return YooAssetSettingsData.GetYooEditorCacheRoot();
|
||||||
|
#elif UNITY_STANDALONE
|
||||||
|
return YooAssetSettingsData.GetYooStandaloneCacheRoot();
|
||||||
|
#else
|
||||||
|
return YooAssetSettingsData.GetYooMobileCacheRoot();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
public string GetCacheFileLoadPath(PackageBundle bundle)
|
public string GetCacheFileLoadPath(PackageBundle bundle)
|
||||||
{
|
{
|
||||||
return GetDataFilePath(bundle);
|
return GetDataFilePath(bundle);
|
||||||
|
|
|
@ -163,8 +163,7 @@ namespace YooAsset
|
||||||
#region 内部方法
|
#region 内部方法
|
||||||
protected string GetDefaultWebRoot()
|
protected string GetDefaultWebRoot()
|
||||||
{
|
{
|
||||||
string path = PathUtility.Combine(UnityEngine.Application.streamingAssetsPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
return YooAssetSettingsData.GetYooWebBuildinRoot();
|
||||||
return path;
|
|
||||||
}
|
}
|
||||||
public string GetWebFileLoadPath(PackageBundle bundle)
|
public string GetWebFileLoadPath(PackageBundle bundle)
|
||||||
{
|
{
|
||||||
|
@ -175,11 +174,6 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
public string GetCatalogFileLoadPath()
|
|
||||||
{
|
|
||||||
string fileName = Path.GetFileNameWithoutExtension(DefaultBuildinFileSystemDefine.BuildinCatalogFileName);
|
|
||||||
return PathUtility.Combine(YooAssetSettingsData.Setting.DefaultYooFolderName, PackageName, fileName);
|
|
||||||
}
|
|
||||||
public string GetWebPackageVersionFilePath()
|
public string GetWebPackageVersionFilePath()
|
||||||
{
|
{
|
||||||
string fileName = YooAssetSettingsData.GetPackageVersionFileName(PackageName);
|
string fileName = YooAssetSettingsData.GetPackageVersionFileName(PackageName);
|
||||||
|
@ -195,10 +189,10 @@ namespace YooAsset
|
||||||
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
|
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
|
||||||
return PathUtility.Combine(FileRoot, fileName);
|
return PathUtility.Combine(FileRoot, fileName);
|
||||||
}
|
}
|
||||||
public string GetStreamingAssetsPackageRoot()
|
public string GetCatalogFileLoadPath()
|
||||||
{
|
{
|
||||||
string rootPath = PathUtility.Combine(Application.dataPath, "StreamingAssets", YooAssetSettingsData.Setting.DefaultYooFolderName);
|
string fileName = Path.GetFileNameWithoutExtension(DefaultBuildinFileSystemDefine.BuildinCatalogFileName);
|
||||||
return PathUtility.Combine(rootPath, PackageName);
|
return YooAssetSettingsData.GetYooResourcesLoadPath(PackageName, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -35,7 +35,8 @@ namespace YooAsset
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
// 兼容性初始化
|
// 兼容性初始化
|
||||||
// 说明:内置文件系统在编辑器下运行时需要动态生成
|
// 说明:内置文件系统在编辑器下运行时需要动态生成
|
||||||
string packageRoot = _fileSystem.GetStreamingAssetsPackageRoot();
|
string buildinRoot = YooAssetSettingsData.GetYooEditorBuildinRoot();
|
||||||
|
string packageRoot = PathUtility.Combine(buildinRoot, _fileSystem.PackageName);
|
||||||
DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(_fileSystem.PackageName, packageRoot);
|
DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(_fileSystem.PackageName, packageRoot);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -3,27 +3,6 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 默认的构建管线
|
|
||||||
/// </summary>
|
|
||||||
public enum EDefaultBuildPipeline
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 内置构建管线
|
|
||||||
/// </summary>
|
|
||||||
BuiltinBuildPipeline,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 可编程构建管线
|
|
||||||
/// </summary>
|
|
||||||
ScriptableBuildPipeline,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 原生文件构建管线
|
|
||||||
/// </summary>
|
|
||||||
RawFileBuildPipeline,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 运行模式
|
/// 运行模式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -89,7 +68,7 @@ namespace YooAsset
|
||||||
/// 创建默认的编辑器文件系统参数
|
/// 创建默认的编辑器文件系统参数
|
||||||
/// <param name="simulateBuildResult">模拟构建结果</param>
|
/// <param name="simulateBuildResult">模拟构建结果</param>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static FileSystemParameters CreateDefaultEditorFileSystemParameters(SimulateBuildResult simulateBuildResult)
|
public static FileSystemParameters CreateDefaultEditorFileSystemParameters(EditorSimulateBuildResult simulateBuildResult)
|
||||||
{
|
{
|
||||||
string fileSystemClass = typeof(DefaultEditorFileSystem).FullName;
|
string fileSystemClass = typeof(DefaultEditorFileSystem).FullName;
|
||||||
var fileSystemParams = new FileSystemParameters(fileSystemClass, simulateBuildResult.PackageRootDirectory);
|
var fileSystemParams = new FileSystemParameters(fileSystemClass, simulateBuildResult.PackageRootDirectory);
|
||||||
|
|
|
@ -58,7 +58,8 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注意:调用底层接口释放所有资源
|
// 注意:调用底层接口释放所有资源
|
||||||
Resources.UnloadUnusedAssets();
|
if (removeList.Count > 0)
|
||||||
|
Resources.UnloadUnusedAssets();
|
||||||
|
|
||||||
_steps = ESteps.Done;
|
_steps = ESteps.Done;
|
||||||
Status = EOperationStatus.Succeed;
|
Status = EOperationStatus.Succeed;
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
namespace YooAsset
|
||||||
|
{
|
||||||
|
public class EditorSimulateBuildParam
|
||||||
|
{
|
||||||
|
public string PackageName;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 720a3c8ecde4cd443bedd238c03713c0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
public class SimulateBuildResult
|
public class EditorSimulateBuildResult
|
||||||
{
|
{
|
||||||
public string PackageRootDirectory;
|
public string PackageRootDirectory;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,20 +10,12 @@ namespace YooAsset
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑器下模拟构建清单
|
/// 编辑器下模拟构建清单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static SimulateBuildResult SimulateBuild(string buildPipelineName, string packageName)
|
public static EditorSimulateBuildResult SimulateBuild(EditorSimulateBuildParam buildParam)
|
||||||
{
|
{
|
||||||
if (_classType == null)
|
if (_classType == null)
|
||||||
_classType = Assembly.Load("YooAsset.Editor").GetType("YooAsset.Editor.AssetBundleSimulateBuilder");
|
_classType = Assembly.Load("YooAsset.Editor").GetType("YooAsset.Editor.AssetBundleSimulateBuilder");
|
||||||
|
|
||||||
return (SimulateBuildResult)InvokePublicStaticMethod(_classType, "SimulateBuild", buildPipelineName, packageName);
|
return (EditorSimulateBuildResult)InvokePublicStaticMethod(_classType, "SimulateBuild", buildParam);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 编辑器下模拟构建清单
|
|
||||||
/// </summary>
|
|
||||||
public static SimulateBuildResult SimulateBuild(EDefaultBuildPipeline buildPipeline, string packageName)
|
|
||||||
{
|
|
||||||
return SimulateBuild(buildPipeline.ToString(), packageName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static object InvokePublicStaticMethod(System.Type type, string method, params object[] parameters)
|
private static object InvokePublicStaticMethod(System.Type type, string method, params object[] parameters)
|
||||||
|
@ -43,12 +35,7 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
public static class EditorSimulateModeHelper
|
public static class EditorSimulateModeHelper
|
||||||
{
|
{
|
||||||
public static SimulateBuildResult SimulateBuild(string buildPipelineName, string packageName)
|
public static EditorSimulateBuildResult SimulateBuild(EditorSimulateBuildParam buildParam)
|
||||||
{
|
|
||||||
throw new System.Exception("Only support in unity editor !");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SimulateBuildResult SimulateBuild(EDefaultBuildPipeline buildPipeline, string packageName)
|
|
||||||
{
|
{
|
||||||
throw new System.Exception("Only support in unity editor !");
|
throw new System.Exception("Only support in unity editor !");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using UnityEngine;
|
using System.IO;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace YooAsset
|
namespace YooAsset
|
||||||
{
|
{
|
||||||
|
@ -71,5 +72,115 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
return $"{Setting.ManifestFileName}_{packageName}.version";
|
return $"{Setting.ManifestFileName}_{packageName}.version";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 路径相关
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的Resources目录的加载路径
|
||||||
|
/// </summary>
|
||||||
|
public static string GetYooResourcesLoadPath(string packageName, string fileName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
return PathUtility.Combine(packageName, fileName);
|
||||||
|
else
|
||||||
|
return PathUtility.Combine(Setting.DefaultYooFolderName, packageName, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的Resources目录的全路径
|
||||||
|
/// </summary>
|
||||||
|
public static string GetYooResourcesFullPath()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
return $"Assets/Resources";
|
||||||
|
else
|
||||||
|
return $"Assets/Resources/{Setting.DefaultYooFolderName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的编辑器下内置文件根目录
|
||||||
|
/// </summary>
|
||||||
|
public static string GetYooEditorBuildinRoot()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
return PathUtility.Combine(Application.dataPath, "StreamingAssets");
|
||||||
|
else
|
||||||
|
return PathUtility.Combine(Application.dataPath, "StreamingAssets", Setting.DefaultYooFolderName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的PC端内置文件根目录
|
||||||
|
/// </summary>
|
||||||
|
public static string GetYooStandaloneBuildinRoot()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
return Application.streamingAssetsPath;
|
||||||
|
else
|
||||||
|
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的移动端内置文件根目录
|
||||||
|
/// </summary>
|
||||||
|
public static string GetYooMobileBuildinRoot()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
return Application.streamingAssetsPath;
|
||||||
|
else
|
||||||
|
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的Web端内置文件根目录
|
||||||
|
/// </summary>
|
||||||
|
public static string GetYooWebBuildinRoot()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
return Application.streamingAssetsPath;
|
||||||
|
else
|
||||||
|
return PathUtility.Combine(Application.streamingAssetsPath, Setting.DefaultYooFolderName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的编辑器下缓存文件根目录
|
||||||
|
/// </summary>
|
||||||
|
public static string GetYooEditorCacheRoot()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
{
|
||||||
|
string projectPath = Path.GetDirectoryName(Application.dataPath);
|
||||||
|
projectPath = PathUtility.RegularPath(projectPath);
|
||||||
|
return projectPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 注意:为了方便调试查看,编辑器下把存储目录放到项目根目录下。
|
||||||
|
string projectPath = Path.GetDirectoryName(Application.dataPath);
|
||||||
|
projectPath = PathUtility.RegularPath(projectPath);
|
||||||
|
return PathUtility.Combine(projectPath, Setting.DefaultYooFolderName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的PC端缓存文件根目录
|
||||||
|
/// </summary>
|
||||||
|
public static string GetYooStandaloneCacheRoot()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
return Application.dataPath;
|
||||||
|
else
|
||||||
|
return PathUtility.Combine(Application.dataPath, Setting.DefaultYooFolderName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取YOO的移动端缓存文件根目录
|
||||||
|
/// </summary>
|
||||||
|
public static string GetYooMobileCacheRoot()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
|
||||||
|
return Application.persistentDataPath;
|
||||||
|
else
|
||||||
|
return PathUtility.Combine(Application.persistentDataPath, Setting.DefaultYooFolderName);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -143,7 +143,7 @@ public static class ShaderVariantCollector
|
||||||
List<string> allAssets = new List<string>(1000);
|
List<string> allAssets = new List<string>(1000);
|
||||||
|
|
||||||
// 获取所有打包的资源
|
// 获取所有打包的资源
|
||||||
CollectResult collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(EBuildMode.DryRunBuild, _packageName);
|
CollectResult collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(true, _packageName);
|
||||||
foreach (var assetInfo in collectResult.CollectAssets)
|
foreach (var assetInfo in collectResult.CollectAssets)
|
||||||
{
|
{
|
||||||
string[] depends = AssetDatabase.GetDependencies(assetInfo.AssetInfo.AssetPath, true);
|
string[] depends = AssetDatabase.GetDependencies(assetInfo.AssetInfo.AssetPath, true);
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class CopyBuildinManifestOperation : GameAsyncOperation
|
||||||
|
|
||||||
private string GetBuildinYooRoot()
|
private string GetBuildinYooRoot()
|
||||||
{
|
{
|
||||||
return PathUtility.Combine(Application.streamingAssetsPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
return YooAssetSettingsData.GetYooMobileBuildinRoot();
|
||||||
}
|
}
|
||||||
private string GetBuildinHashFilePath()
|
private string GetBuildinHashFilePath()
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,7 @@ public class CopyBuildinManifestOperation : GameAsyncOperation
|
||||||
|
|
||||||
private string GetCacheYooRoot()
|
private string GetCacheYooRoot()
|
||||||
{
|
{
|
||||||
return PathUtility.Combine(UnityEngine.Application.persistentDataPath, YooAssetSettingsData.Setting.DefaultYooFolderName);
|
return YooAssetSettingsData.GetYooMobileCacheRoot();
|
||||||
}
|
}
|
||||||
private string GetCacheHashFilePath()
|
private string GetCacheHashFilePath()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using YooAsset;
|
||||||
|
|
||||||
|
public static class YooAssetsExtension
|
||||||
|
{
|
||||||
|
public static LoadGameObjectOperation LoadGameObjectAsync(this ResourcePackage resourcePackage, string location, Vector3 position, Quaternion rotation, Transform parent, bool destroyGoOnRelease = false)
|
||||||
|
{
|
||||||
|
var operation = new LoadGameObjectOperation(location, position, rotation, parent, destroyGoOnRelease);
|
||||||
|
YooAssets.StartOperation(operation);
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LoadGameObjectOperation : GameAsyncOperation
|
||||||
|
{
|
||||||
|
private enum ESteps
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
LoadAsset,
|
||||||
|
Done,
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly string _location;
|
||||||
|
private readonly Vector3 _positon;
|
||||||
|
private readonly Quaternion _rotation;
|
||||||
|
private readonly Transform _parent;
|
||||||
|
private readonly bool _destroyGoOnRelease;
|
||||||
|
private AssetHandle _handle;
|
||||||
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载的游戏对象
|
||||||
|
/// </summary>
|
||||||
|
public GameObject Go { private set; get; }
|
||||||
|
|
||||||
|
|
||||||
|
public LoadGameObjectOperation(string location, Vector3 position, Quaternion rotation, Transform parent, bool destroyGoOnRelease = false)
|
||||||
|
{
|
||||||
|
_location = location;
|
||||||
|
_positon = position;
|
||||||
|
_rotation = rotation;
|
||||||
|
_parent = parent;
|
||||||
|
_destroyGoOnRelease = destroyGoOnRelease;
|
||||||
|
}
|
||||||
|
protected override void OnStart()
|
||||||
|
{
|
||||||
|
_steps = ESteps.LoadAsset;
|
||||||
|
}
|
||||||
|
protected override void OnUpdate()
|
||||||
|
{
|
||||||
|
if (_steps == ESteps.None || _steps == ESteps.Done)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_steps == ESteps.LoadAsset)
|
||||||
|
{
|
||||||
|
if (_handle == null)
|
||||||
|
{
|
||||||
|
_handle = YooAssets.LoadAssetAsync<GameObject>(_location);
|
||||||
|
}
|
||||||
|
|
||||||
|
Progress = _handle.Progress;
|
||||||
|
if (_handle.IsDone == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_handle.Status != EOperationStatus.Succeed)
|
||||||
|
{
|
||||||
|
Error = _handle.LastError;
|
||||||
|
Status = EOperationStatus.Failed;
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Go = _handle.InstantiateSync(_positon, _rotation, _parent);
|
||||||
|
Status = EOperationStatus.Succeed;
|
||||||
|
_steps = ESteps.Done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected override void OnAbort()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 释放资源句柄
|
||||||
|
/// </summary>
|
||||||
|
public void ReleaseHandle()
|
||||||
|
{
|
||||||
|
if (_handle != null)
|
||||||
|
{
|
||||||
|
_handle.Release();
|
||||||
|
|
||||||
|
if (_destroyGoOnRelease)
|
||||||
|
{
|
||||||
|
if (Go != null)
|
||||||
|
GameObject.Destroy(Go);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 55478908ad5dc5541af1529a3faccee7
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -33,7 +33,6 @@ internal class FsmInitializePackage : IStateNode
|
||||||
{
|
{
|
||||||
var playMode = (EPlayMode)_machine.GetBlackboardValue("PlayMode");
|
var playMode = (EPlayMode)_machine.GetBlackboardValue("PlayMode");
|
||||||
var packageName = (string)_machine.GetBlackboardValue("PackageName");
|
var packageName = (string)_machine.GetBlackboardValue("PackageName");
|
||||||
var buildPipeline = (string)_machine.GetBlackboardValue("BuildPipeline");
|
|
||||||
var rawFileSystem = (bool)_machine.GetBlackboardValue("RawFileSystem");
|
var rawFileSystem = (bool)_machine.GetBlackboardValue("RawFileSystem");
|
||||||
|
|
||||||
// 创建资源包裹类
|
// 创建资源包裹类
|
||||||
|
@ -45,7 +44,9 @@ internal class FsmInitializePackage : IStateNode
|
||||||
InitializationOperation initializationOperation = null;
|
InitializationOperation initializationOperation = null;
|
||||||
if (playMode == EPlayMode.EditorSimulateMode)
|
if (playMode == EPlayMode.EditorSimulateMode)
|
||||||
{
|
{
|
||||||
var simulateBuildResult = EditorSimulateModeHelper.SimulateBuild(buildPipeline, packageName);
|
var simulateBuildParam = new EditorSimulateBuildParam();
|
||||||
|
simulateBuildParam.PackageName = packageName;
|
||||||
|
var simulateBuildResult = EditorSimulateModeHelper.SimulateBuild(simulateBuildParam);
|
||||||
var createParameters = new EditorSimulateModeParameters();
|
var createParameters = new EditorSimulateModeParameters();
|
||||||
createParameters.EditorFileSystemParameters = FileSystemParameters.CreateDefaultEditorFileSystemParameters(simulateBuildResult);
|
createParameters.EditorFileSystemParameters = FileSystemParameters.CreateDefaultEditorFileSystemParameters(simulateBuildResult);
|
||||||
initializationOperation = package.InitializeAsync(createParameters);
|
initializationOperation = package.InitializeAsync(createParameters);
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class PatchOperation : GameAsyncOperation
|
||||||
private readonly StateMachine _machine;
|
private readonly StateMachine _machine;
|
||||||
private ESteps _steps = ESteps.None;
|
private ESteps _steps = ESteps.None;
|
||||||
|
|
||||||
public PatchOperation(string packageName, string buildPipeline, bool rawFileSystem, EPlayMode playMode)
|
public PatchOperation(string packageName, bool rawFileSystem, EPlayMode playMode)
|
||||||
{
|
{
|
||||||
// 注册监听事件
|
// 注册监听事件
|
||||||
_eventGroup.AddListener<UserEventDefine.UserTryInitialize>(OnHandleEventMessage);
|
_eventGroup.AddListener<UserEventDefine.UserTryInitialize>(OnHandleEventMessage);
|
||||||
|
@ -41,7 +41,6 @@ public class PatchOperation : GameAsyncOperation
|
||||||
|
|
||||||
_machine.SetBlackboardValue("PackageName", packageName);
|
_machine.SetBlackboardValue("PackageName", packageName);
|
||||||
_machine.SetBlackboardValue("PlayMode", playMode);
|
_machine.SetBlackboardValue("PlayMode", playMode);
|
||||||
_machine.SetBlackboardValue("BuildPipeline", buildPipeline);
|
|
||||||
_machine.SetBlackboardValue("RawFileSystem", rawFileSystem);
|
_machine.SetBlackboardValue("RawFileSystem", rawFileSystem);
|
||||||
}
|
}
|
||||||
protected override void OnStart()
|
protected override void OnStart()
|
||||||
|
|
Loading…
Reference in New Issue