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; }