Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 29c78dc

Browse files
committed
Manually get Major and Minor instead of using Version class
1 parent bf59d9d commit 29c78dc

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/UI/UIManager.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -417,21 +417,17 @@ private static void LoadBundle()
417417
AssetBundle bundle = null;
418418
try
419419
{
420-
// Get the Unity version (without the 'f' suffix).
421-
// I'm not sure if Unity always includes the 'f' suffix.
422-
int len;
423-
if (Application.unityVersion.Contains("f"))
424-
len = Application.unityVersion.LastIndexOf("f");
425-
else
426-
len = Application.unityVersion.Length;
427-
Version version = new Version(Application.unityVersion.Substring(0, len));
420+
// Get the Major and Minor of the Unity version
421+
var split = Application.unityVersion.Split('.');
422+
int major = int.Parse(split[0]);
423+
int minor = int.Parse(split[1]);
428424

429425
// Use appropriate AssetBundle for Unity version
430426
// >= 2017.3
431-
if (version.Major > 2017 || (version.Major == 2017 && version.Minor >= 3))
427+
if (major > 2017 || (major == 2017 && minor >= 3))
432428
bundle = LoadBundle("modern");
433429
// 5.6.0 to 2017.3
434-
else if (version.Major == 2017 || (version.Major == 5 && version.Minor >= 6))
430+
else if (major == 2017 || (major == 5 && minor >= 6))
435431
bundle = LoadBundle("legacy.5.6");
436432
// < 5.6.0
437433
else

0 commit comments

Comments
 (0)