https://github.com/Tencent/xLuagit
另外,连接有官方教程,也有不少demo,多看多想。github
<1> 如何导入XLuaide
1 打开github的连接,下载该项目的zipui
2 解压,打开该文件夹,找到Assets文件夹,把里面的两个文件夹:Plugins 和 XLua拖到Unity》project》Assets下,就导入成功le了。另外还要注意,因为要用到一个叫XLuaHotfixInject.exe的程序,也要将Toos文件夹按照上面的方式导入到unity。结果以下图blog
3 导入Toos文件夹shi时,unity会报system.dll 文件重复的错误,删除掉提示重复的dll,结果如上图所示教程
<2> 如何热更ip
1 这里以官方案例 08 来讲明如何操做。rem
2 首先要先定义unity的宏,依次打开:file>build setting>player setting>other setting>scripting define symbols 在这个下面的文本框内输入 :HOTFIX_ENABLE 由于我是在电脑上运行的,因此我是在pc设置的窗口添加的,最终以下图:string
3 添加了上一步以后,你才会在菜单栏XLua里看到Hotfix inject in editor。这个时候it
时候若是你直接点XLua》HotFix inject editor,系统会报 please install the Tools 的错误,缘由是路径不对,没有找到XLuaHotfixInject.exe。这个时候,找到报错的地方,而后修改exe的路径,若是文件路径和我上面的同样,能够直接修改成:
var inject_tool_path = "Assets/Tools/XLuaHotfixInject.exe";
4. 前面的步骤作完后,就能够运行08的示例,运行步骤:XLua>Generate cod, 而后XLua >Hotfix inject in editor,最后点击运行,就能够看到案例成功运行啦。
5. 编译打包时遇到
Assets/XLua/Gen/UnityEngineLightWrap.cs(723,60): error CS1061: Type `UnityEngine.Light' does not contain a definition for `shadowRadius' and no extension method `shadowRadius' of type `UnityEngine.Light' could be found. Are you missing an assembly reference?
解决方案,在 static cs的配置文件中添加黑名单,黑名单最好放到Edit 文件夹下。添加以下
new List<string>(){"UnityEngine.Light", "shadowRadius"},
new List<string>(){"UnityEngine.Light", "shadowAngle"},
6. 报“please install the Tools”
没有把Tools安装到Assets平级目录,安装包,或者master下都能找到这个目录。
7. 导入Tools 提示 ,system 和 system core重复导入
An assembly `System' with the same identity has already been imported. Consider removing one of the references
解决方案,把system的dll 所有删掉,以下
8. 把Tools 文件夹导入到Asset 文件夹目录下还 提示 “please install the Tools”
缘由在mac 下不识别路径 ./Tools/XLuaHotfixInject.exe 改为 Assets/Tools/XLuaHotfixInject.exe
文件在 Hotfix.cs 文件中的1615 行
var inject_tool_path = "Assets/Tools/XLuaHotfixInject.exe"; if (!File.Exists(inject_tool_path)) { UnityEngine.Debug.LogError("please install the Tools"); return; }