当前位置:网站首页>Ilruntime learning - start from scratch
Ilruntime learning - start from scratch
2022-07-03 07:57:00 【qq_ two billion three hundred and eighty-five million seven hun】
1, ILRuntime The project is based on C# The platform of ( for example Unity) Provides a pure C# Realization , Fast , Convenient and reliable IL Runtime , Make it possible to support JIT Hardware environment ( Such as iOS) It can realize the hot update of code
2, Seamless access C# Off the shelf code of the project , No additional Abstract scripts are required API
The recommended way is to use directly ILRuntime Source code ,, such ILRuntime It can be optimized automatically according to your publishing settings .
3, Copy the following source directory Unity engineering Assets Catalog :
Mono.Cecil.20Mono.Cecil.PdbILRuntime
Delete these directories bin、obj、Properties subdirectories , as well as .csproj file .
ILRuntime Used unsafe Code to optimize execution efficiency , So you need to be in Unity In the open unsafe Pattern :
If you're using Unity5.4 And previous versions , And the compilation settings used are .Net 2.0 instead of .Net 2.0 Subset Words ,
You need to put smcs.rsp Change the file name to gmcs.rsp. If you're using Unity5.5 Version above , You need to put smcs.rsp Change the file name to mcs.rsp
Unity3D Example project of
You can https://github.com/Ourpalm/ILRuntimeU3D Download to the latest Unity Case Engineering , This example is in Unity5.5 Made under .
There are 2 A project , among ILRuntimeDemo yes Unity The main project . The examples are in each example scenario in this project , This project is in Unity5.5 Next is the finished
HotFix_Project It's hotter DLL engineering , use VS2015 And so on. C# IDE Open and compile , Please make sure to open it at least once before compiling Unity The main project , If the compiler still says it cannot be found UnityEngine etc. dll, Please manually re identify
from Visual Studio Start
stay VisualStudio Of C# Project use ILRuntime, You need to reference the compiled ILRuntime.dll,Mono.Cecil.20.dll as well as Mono.Cecil.Pdb.
Start using
Use ILRuntime It's simple , Only the following code is needed to run a complete example :
ILRuntime.Runtime.Enviorment.AppDomain appdomain;
void Start()
{
StartCoroutine(LoadILRuntime());
}
IEnumerator LoadILRuntime()
{
appdomain = new ILRuntime.Runtime.Enviorment.AppDomain();
#if UNITY_ANDROID
WWW www = new WWW(Application.streamingAssetsPath + "/Hotfix.dll");
#else
WWW www = new WWW("file:///" + Application.streamingAssetsPath + "/Hotfix.dll");
#endif
while (!www.isDone)
yield return null;
if (!string.IsNullOrEmpty(www.error))
D.error(www.error);
byte[] dll = www.bytes;
www.Dispose();
#if UNITY_ANDROID
www = new WWW(Application.streamingAssetsPath + "/Hotfix.pdb");
#else
www = new WWW("file:///" + Application.streamingAssetsPath + "/Hotfix.pdb");
#endif
while (!www.isDone)
yield return null;
if (!string.IsNullOrEmpty(www.error))
D.error(www.error);
byte[] pdb = www.bytes;
using (System.IO.MemoryStream fs = new MemoryStream(dll))
{
using (System.IO.MemoryStream p = new MemoryStream(pdb))
{
appdomain.LoadAssembly(fs, p, new Mono.Cecil.Pdb.PdbReaderProvider());
}
}
OnILRuntimeInitialized();
}
void OnILRuntimeInitialized()
{
appdomain.Invoke("Hotfix.Game", "Initialize", null, null);
}This example is for the convenience of demonstration , Directly from StreamingAssets The script is read from the directory DLL Files and debugging symbols PDB file , When actually released , If you want to be hotter , It must be DLL and PDB Package files to Assetbundle For dynamic loading ,
Debug plug-ins
Support Visual Studio2015 and Visual Studio 2017 Debugging plug-ins
https://github.com/Ourpalm/ILRuntime/releases
How to use it is as follows :
- install ILRuntime Debug plug-ins , And restart VS2015 or VS2017
- function Unity engineering , And ensure that appdomain.DebugService.StartDebugService(56000); To start the debug server
- use VisualStudio Turn on hot change DLL project
- Click... On the menu Debug->Attach to ILRuntime Button
- Fill the pop-up window with the name of the host being debugged IP Address and port of debugging server
- Click on Attach After button , It's like UnityVS Same as the breakpoint debugging
边栏推荐
- The general trend of data news releases the power of visual reporting ----- essays after reading
- 华为交换机基础配置(telnet/ssh登录)
- OSPF experiment
- Idea dereference display effect
- I want to do large screen data visualization application feature analysis
- register关键字
- tslib库的移植
- [at] abc 258G - Triangle 三元组可达-暴力
- Viz artist advanced script video tutorial -- stringmap use and vertex operation
- 多旅行商问题——公式和求解过程概述
猜你喜欢

Research shows that breast cancer cells are more likely to enter the blood when patients sleep

My touch screen production "brief history" 1

*p++、*++p、++*p、(*p)++

haproxy+keepalived搭建01

Getting started with minicom

The difference between hdmi2.1 and hdmi2.0 and the conversion of PD signals.

Go language foundation ----- 13 ----- file

Pat class a 1030 travel plan

What to do after the browser enters the URL

Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does
随机推荐
WPF:解决MaterialDesign:DialogHost 无法关闭问题
Pat class a 1031 Hello world for u
Research shows that breast cancer cells are more likely to enter the blood when patients sleep
[at] ABC 258g - Triangle triples reachable - violence
[USACO12MAR]Cows in a Skyscraper G(状态压缩dp)
[step on the pit series] MySQL failed to modify the root password
[at] abc 258G - Triangle 三元組可達-暴力
Professor Zhang Yang of the University of Michigan is employed as a visiting professor of Shanghai Jiaotong University, China (picture)
OSPF protocol summary
Go language foundation ----- 18 ----- collaboration security, mutex lock, read-write lock, anonymous lock, sync Once
Precautions for opensips and TLS SIP trunk docking
华为交换机基础配置(telnet/ssh登录)
C2-关于VCF文件合并的几种方法
华为S5700交换机初始化和配置telnet,ssh用户方法
【LeetCode】4. Best time to buy and sell stock
Free use until 2015 -- viz artist multi touch plug-in package
一条通往服务器所有端口的隧道
How does yarn link help developers debug NPM packages?
Differences between tp3.2 and tp5.0
YOLO系列 --- xml2txt脚本