diff --git a/NewLife.Core/Common/Runtime.cs b/NewLife.Core/Common/Runtime.cs
index f4b997f..c5c6121 100644
--- a/NewLife.Core/Common/Runtime.cs
+++ b/NewLife.Core/Common/Runtime.cs
@@ -13,6 +13,22 @@ namespace NewLife;
/// </remarks>
public static class Runtime
{
+ #region 静态构造
+ static Runtime()
+ {
+ try
+ {
+ Mono = Type.GetType("Mono.Runtime") != null;
+ }
+ catch { }
+ try
+ {
+ Unity = Type.GetType("UnityEngine.Application, UnityEngine") != null;
+ }
+ catch { }
+ }
+ #endregion
+
#region 控制台
private static Boolean? _IsConsole;
/// <summary>是否控制台。用于判断是否可以执行一些控制台操作。</summary>
@@ -49,10 +65,10 @@ public static class Runtime
#region 系统特性
/// <summary>是否Mono环境</summary>
- public static Boolean Mono { get; } = Type.GetType("Mono.Runtime") != null;
+ public static Boolean Mono { get; }
/// <summary>是否Unity环境</summary>
- public static Boolean Unity { get; } = Type.GetType("UnityEngine.Application, UnityEngine") != null;
+ public static Boolean Unity { get; }
#if !NETFRAMEWORK
private static Boolean? _IsWeb;