From 29c78dc5a6fc2661e976ca12af107e0a1eae78a2 Mon Sep 17 00:00:00 2001 From: Sinai Date: Sun, 11 Jul 2021 23:12:17 +1000 Subject: [PATCH] Manually get Major and Minor instead of using Version class --- src/UI/UIManager.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/UI/UIManager.cs b/src/UI/UIManager.cs index b3a15f9..32009a2 100644 --- a/src/UI/UIManager.cs +++ b/src/UI/UIManager.cs @@ -417,21 +417,17 @@ namespace UnityExplorer.UI AssetBundle bundle = null; try { - // Get the Unity version (without the 'f' suffix). - // I'm not sure if Unity always includes the 'f' suffix. - int len; - if (Application.unityVersion.Contains("f")) - len = Application.unityVersion.LastIndexOf("f"); - else - len = Application.unityVersion.Length; - Version version = new Version(Application.unityVersion.Substring(0, len)); + // Get the Major and Minor of the Unity version + var split = Application.unityVersion.Split('.'); + int major = int.Parse(split[0]); + int minor = int.Parse(split[1]); // Use appropriate AssetBundle for Unity version // >= 2017.3 - if (version.Major > 2017 || (version.Major == 2017 && version.Minor >= 3)) + if (major > 2017 || (major == 2017 && minor >= 3)) bundle = LoadBundle("modern"); // 5.6.0 to 2017.3 - else if (version.Major == 2017 || (version.Major == 5 && version.Minor >= 6)) + else if (major == 2017 || (major == 5 && minor >= 6)) bundle = LoadBundle("legacy.5.6"); // < 5.6.0 else