private void OnHotFixLoaded(ILRuntime.Runtime.Enviorment.AppDomain appDomain) { Debug.Log("OnHotFixLoaded"); m_appDomain = appDomain; IType hotFixGameRootType = m_appDomain.LoadedTypes["HotFix_Project.GameRoot"]; m_gameRoot = ((ILType)hotFixGameRootType).Instantiate(); UnityEngine.Object.Destroy(m_hotFixLoader); m_hotFixLoader = null; IMethod method = hotFixGameRootType.GetMethod("Start", 0); using (var ctx = appDomain.BeginInvoke(method)) { ctx.PushObject(m_gameRoot); ctx.Invoke(); } m_updateMethod = hotFixGameRootType.GetMethod("Update", 0); }
// Start is called before the first frame update public void Init(bool loadFromDll) { m_hotFixLoader = gameObject.AddComponent <HotFixLoader>(); m_hotFixLoader.Init(OnHotFixLoaded, loadFromDll); }