diff --git a/IPA.Loader/Utilities/UnityGame.cs b/IPA.Loader/Utilities/UnityGame.cs index 1bb01f71..c10d3aac 100644 --- a/IPA.Loader/Utilities/UnityGame.cs +++ b/IPA.Loader/Utilities/UnityGame.cs @@ -28,7 +28,27 @@ namespace IPA.Utilities _gameVersion = ver; Logging.Logger.log.Debug($"GameVersion set early to {ver}"); } - private static string ApplicationVersionProxy => Application.version; + private static string ApplicationVersionProxy + { + get + { + try + { + return Application.version; + } + catch(MissingMemberException ex) + { + Logging.Logger.log.Error($"Tried to grab 'Application.version' too early, it's probably broken now."); + Logging.Logger.log.Debug(ex); + } + catch (Exception ex) + { + Logging.Logger.log.Error($"Error getting Application.version: {ex.Message}"); + Logging.Logger.log.Debug(ex); + } + return string.Empty; + } + } internal static void EnsureRuntimeGameVersion() { try @@ -71,7 +91,7 @@ namespace IPA.Utilities /// if the curent thread is the Unity main thread, otherwise public static bool OnMainThread => Thread.CurrentThread.ManagedThreadId == mainThread?.ManagedThreadId; - internal static void SetMainThread() + internal static void SetMainThread() => mainThread = Thread.CurrentThread; ///