[opt] `Generate/All`在生成之前检查是否已经安装HybridCLR

main
walon 2024-05-25 09:49:22 +08:00
parent d45974c6b4
commit 63d0aaa6e6
1 changed files with 6 additions and 0 deletions

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using UnityEditor; using UnityEditor;
using UnityEditor.Build;
namespace HybridCLR.Editor.Commands namespace HybridCLR.Editor.Commands
{ {
@ -15,6 +16,11 @@ namespace HybridCLR.Editor.Commands
[MenuItem("HybridCLR/Generate/All", priority = 200)] [MenuItem("HybridCLR/Generate/All", priority = 200)]
public static void GenerateAll() public static void GenerateAll()
{ {
var installer = new Installer.InstallerController();
if (!installer.HasInstalledHybridCLR())
{
throw new BuildFailedException($"You have not initialized HybridCLR, please install it via menu 'HybridCLR/Installer'");
}
BuildTarget target = EditorUserBuildSettings.activeBuildTarget; BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
CompileDllCommand.CompileDll(target); CompileDllCommand.CompileDll(target);
Il2CppDefGeneratorCommand.GenerateIl2CppDef(); Il2CppDefGeneratorCommand.GenerateIl2CppDef();