Vscode+Unity断点调试三部曲(二):引入Emmylua插件
断点调试三部曲(二):引入Emmylua插件
-
用Vscode安装插件
-
打开你的lua文件所在目录,然后创建json文件
-
修改《Test_C.cs》文件
-
端口占用会报这个错误,修改下端口号就好
-
安装完Emmylua插件后,会获得一个dll文件,我的路径是:C:\Users\Administrator\.vscode\extensions\tangzx.emmylua-0.3.49\debugger\emmy\windows\x64
-
把这个文件拷贝到unity工程Assets同级目录下
-
修改《Test_L.lua》文件
-
首次启动,若不先启动unity,会报错
《Test_C.cs》 新增代码,update() private void Update() { if (Input.GetKeyDown(KeyCode.Q)) { func.Call(gameObject); } } 新增代码,LuaStart() .... string path = Directory.GetCurrentDirectory(); if (File.Exists(path + "/emmy_core.dll")) { env.DoString(" local dbg = require('emmy_core') dbg.tcpListen('localhost', 9898)"); } ...
《launch.json》 { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "emmylua_new", "request": "launch", "name": "EmmyLua New Debug", "host": "localhost", "port": 9898, "ext": [ ".lua", ".lua.txt", ".lua.bytes" ], "ideConnectDebugger": true } ] }