From bf59d9d6cd526f8fb200200d1232222c92a07739 Mon Sep 17 00:00:00 2001 From: Sinai Date: Sun, 11 Jul 2021 18:19:09 +1000 Subject: [PATCH] Handle cases where Unity doesn't include 'f' suffix on version Not sure if this ever happens but just in case --- src/UI/UIManager.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/UI/UIManager.cs b/src/UI/UIManager.cs index 4471038..b3a15f9 100644 --- a/src/UI/UIManager.cs +++ b/src/UI/UIManager.cs @@ -417,8 +417,14 @@ namespace UnityExplorer.UI AssetBundle bundle = null; try { - // Get the Unity version (without the 'f_' suffix). - Version version = new Version(Application.unityVersion.Substring(0, Application.unityVersion.LastIndexOf('f'))); + // 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)); // Use appropriate AssetBundle for Unity version // >= 2017.3