Update CustomBuildTool.cs

完善工具
pull/1/head
zhangxl 2024-07-22 16:22:32 +08:00
parent d5f301fd30
commit 374ecc1d2a
1 changed files with 25 additions and 2 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
@ -9,6 +10,7 @@ using UnityEditor.Build.Reporting;
using UnityEngine;
using UnityEngine.SceneManagement;
using YooAsset;
using Debug = UnityEngine.Debug;
namespace ZEditor
{
@ -27,9 +29,9 @@ namespace ZEditor
WebGL,
}
private static string pc = "Builds/PC";
private static string pc = "Builds/PC/Game.exe";
private static string webgl = "Builds/WebGL";
private static string android = "Builds/Android";
private static string android = "Builds/Android/Game.apk";
#region Win
@ -104,6 +106,8 @@ namespace ZEditor
if (summary.result == BuildResult.Succeeded)
{
string path = Application.dataPath.Replace("Assets", outputFilePath);
OpenFolder(path);
Debug.Log($"{buildTarget} 平台构建完成! ");
}
else if (summary.result == BuildResult.Cancelled)
@ -121,6 +125,23 @@ namespace ZEditor
// Progress.Start("explorer.exe", outputFilePath);
}
private static void OpenFolder(string path)
{
// 根据不同的操作系统调用不同的命令来打开文件夹
switch (Application.platform)
{
case RuntimePlatform.WindowsEditor:
Process.Start("explorer.exe", path);
break;
case RuntimePlatform.OSXEditor:
Process.Start("open", path);
break;
case RuntimePlatform.LinuxEditor:
Process.Start("xdg-open", path);
break;
}
}
//
static void ChangeAssetLoadMode(BuildType buildType)
{
@ -156,6 +177,8 @@ namespace ZEditor
else
Debug.LogError("检查一下打包出问题了没找到global");
EditorUtility.SetDirty(gameObject);
Debug.Log($"资源加载模式自动更改为 {playMode}.");
}
}