diff --git a/Unity/Assets/Scripts/Base/Object/ObjectEvents.cs b/Unity/Assets/Scripts/Base/Object/ObjectEvents.cs index 8f3bd4e4eb5756aa5bbb126bbb4b5e16c4134851..db8bf65b6b1398fec28958c109df1fdf58cba9e6 100644 --- a/Unity/Assets/Scripts/Base/Object/ObjectEvents.cs +++ b/Unity/Assets/Scripts/Base/Object/ObjectEvents.cs @@ -54,7 +54,6 @@ namespace Model set { this.hotfixAssembly = value; - this.Load(); } } @@ -78,6 +77,16 @@ namespace Model instance = null; } + public void LoadHotfixDll() + { +#if ILRuntime + DllHelper.LoadHotfixAssembly(); +#else + ObjectEvents.Instance.HotfixAssembly = DllHelper.LoadHotfixAssembly(); +#endif + this.Load(); + } + public void Add(string name, Assembly assembly) { this.assemblies[name] = assembly; diff --git a/Unity/Assets/Scripts/Init.cs b/Unity/Assets/Scripts/Init.cs index d8eae0120af28e5a8e9e3039b709696832e6fbce..c118038d27b777bd12ca2c109b3f2bec345ce39f 100644 --- a/Unity/Assets/Scripts/Init.cs +++ b/Unity/Assets/Scripts/Init.cs @@ -41,7 +41,7 @@ namespace Model Log.Debug("run in ilruntime mode"); this.AppDomain = new ILRuntime.Runtime.Enviorment.AppDomain(); - DllHelper.LoadHotfixAssembly(); + ObjectEvents.Instance.LoadHotfixDll(); ILHelper.InitILRuntime(); this.start = new ILStaticMethod("Hotfix.Init", "Start", 0); @@ -50,7 +50,7 @@ namespace Model this.onApplicationQuit = new ILStaticMethod("Hotfix.Init", "OnApplicationQuit", 0); #else Log.Debug("run in mono mode"); - ObjectEvents.Instance.HotfixAssembly = DllHelper.LoadHotfixAssembly(); + ObjectEvents.Instance.LoadHotfixDll(); Type hotfixInit = ObjectEvents.Instance.HotfixAssembly.GetType("Hotfix.Init"); this.start = new MonoStaticMethod(hotfixInit, "Start"); this.update = new MonoStaticMethod(hotfixInit, "Update"); diff --git a/Unity/Hotfix/Base/Message/IMHandler.cs b/Unity/Hotfix/Base/Message/IMHandler.cs index 6146a552c80fa1bcef0331656bbaa5001485fe54..b377b28a9308d915d6851cec207bd607edd0895e 100644 --- a/Unity/Hotfix/Base/Message/IMHandler.cs +++ b/Unity/Hotfix/Base/Message/IMHandler.cs @@ -1,4 +1,5 @@ using System; +using Model; namespace Hotfix {