Exemplo n.º 1
0
        /// <summary>
        /// 执行热更新
        /// </summary>
        private void RunHotFixVrCoreEntity()
        {
            //热更代码入口处
            _hotFixVrCoreEntity = Appdomain.Instantiate <SubMonoBehavior>("HotFix.Taurus.HotFixMode");
#if UNITY_EDITOR
            if (_hotFixVrCoreEntity == null)
            {
                UnityEngine.Debug.LogError("_hotFixVrCoreEntity == null \n 无法进入热更代码!");
            }
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// 加载热更新代码
        /// </summary>
        /// <param name="dll"></param>
        /// <param name="pdb"></param>
        private void LoadHotfixAssembly(byte[] dll, byte[] pdb = null)
        {
            using (System.IO.MemoryStream ms = new System.IO.MemoryStream(dll))
            {
                if (pdb == null)
                {
                    Appdomain.LoadAssembly(ms, null, new Mono.Cecil.Pdb.PdbReaderProvider());
                }
                else
                {
                    using (System.IO.MemoryStream p = new System.IO.MemoryStream(pdb))
                    {
                        Appdomain.LoadAssembly(ms, p, new Mono.Cecil.Pdb.PdbReaderProvider());
                    }
                }
            }

            //初始化ILRuntime
            InitializeILRuntime();
            //运行热更新的入口
            RunHotFixVrCoreEntity();
        }