From 41c73fe35b65042119ce3a1c4167f29c8a5644b5 Mon Sep 17 00:00:00 2001 From: walon Date: Fri, 30 Jun 2023 12:20:56 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E4=B8=8D=E5=85=BC=E5=AE=B9=E7=89=88=E6=9C=AC=E6=89=93=E5=BC=80?= =?UTF-8?q?Installer=E6=97=B6=E5=87=BA=E7=8E=B0=E5=BC=82=E5=B8=B8=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Installer/InstallerController.cs | 11 ++++++----- Editor/Installer/InstallerWindow.cs | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Editor/Installer/InstallerController.cs b/Editor/Installer/InstallerController.cs index 25f628c..4f3d956 100644 --- a/Editor/Installer/InstallerController.cs +++ b/Editor/Installer/InstallerController.cs @@ -122,13 +122,14 @@ namespace HybridCLR.Editor.Installer { switch(majorVersion) { + case 2020: return $"2020.3.{min2020_3_CompatibleMinorVersion}"; case 2021: return $"2021.3.{min2021_3_CompatibleMinorVersion}"; case 2022: return $"2022.3.{min2022_3_CompatibleMinorVersion}"; - default: throw new Exception($"not support version:{majorVersion}"); + default: return $"2020.3.{min2020_3_CompatibleMinorVersion}"; } } - public bool IsComaptibleVersion() + public bool IsCompatibleVersion() { UnityVersion version = _curVersion; if (version == null) @@ -157,9 +158,9 @@ namespace HybridCLR.Editor.Installer } } - public string HybridclrLocalVersion => _curDefaultVersion.hybridclr.branch; + public string HybridclrLocalVersion => _curDefaultVersion?.hybridclr?.branch; - public string Il2cppPlusLocalVersion => _curDefaultVersion.il2cpp_plus.branch; + public string Il2cppPlusLocalVersion => _curDefaultVersion?.il2cpp_plus?.branch; private string GetIl2CppPathByContentPath(string contentPath) @@ -222,7 +223,7 @@ namespace HybridCLR.Editor.Installer private void RunInitLocalIl2CppData(string editorIl2cppPath, string libil2cppWithHybridclrSourceDir, UnityVersion version) { - if (!IsComaptibleVersion()) + if (!IsCompatibleVersion()) { Debug.LogError($"il2cpp 版本不兼容,最小版本为 {GetCurrentUnityVersionMinCompatibleVersionStr()}"); return; diff --git a/Editor/Installer/InstallerWindow.cs b/Editor/Installer/InstallerWindow.cs index 61535a8..7e1a71f 100644 --- a/Editor/Installer/InstallerWindow.cs +++ b/Editor/Installer/InstallerWindow.cs @@ -54,13 +54,13 @@ namespace HybridCLR.Editor.Installer GUILayout.Space(10f); - if (_controller.IsComaptibleVersion()) + if (_controller.IsCompatibleVersion()) { GUIInstallButton("安装hybridclr+il2cpp_plus代码到本地目录", "安装"); } else { - EditorGUILayout.HelpBox("与当前版本不兼容", MessageType.Error); + EditorGUILayout.HelpBox($"与当前版本不兼容,最小兼容版本:{_controller.GetCurrentUnityVersionMinCompatibleVersionStr()}", MessageType.Error); } EditorGUILayout.EndVertical();