Unity2021配置VSCode+EmmyLua调试
2023/03
22
21:03
一、VSCode安装EmmyLua插件
二、拷EmmyLua的文件到项目目录中
C:\Users\用户名\.vscode\extensions\tangzx.emmylua-0.5.13\debugger\emmy\windows\
中的x64和x86拷到Tool\emmylua\中
D:\Project\Assets\
D:\Project\Tool\emmylua\x86\...
D:\Project\Tool\emmylua\x64\...
三、添加以下代码至启动的lua中
local function startDebugger()
--- 把emmylua的dll所在路径添加到lua的搜索路径中去
package.cpath = package.cpath..';.\\Tool\\emmylua\\x64\\?.dll'
local dbg = require("emmy_core")
dbg.tcpConnect('localhost', 9966)
end
local ret, errstr = pcall(startDebugger)
if not ret then
print(errstr)
end
四、VSCode添加启动配置
在 .vscode/launch.json中,配置 emmylua
{
"version": "0.2.0",
"configurations": [
{
"type": "emmylua_new",
"request": "launch",
"name": "EmmyLua New Debug",
"host": "localhost",
"port": 9966,
"ext": [
".lua",
".lua.txt",
".lua.bytes"
],
"ideConnectDebugger": false
},
}
五、先启动VSCode,再打开游戏
附:EmmyLua+C# 调试的VSCode之launch.json配置
{
"version": "0.2.0",
"configurations": [
{
"type": "emmylua_new",
"request": "launch",
"name": "EmmyLua New Debug",
"host": "localhost",
"port": 9966,
"ext": [
".lua",
".lua.txt",
".lua.bytes"
],
"ideConnectDebugger": false
},
{
"name": "Unity Editor",
"type": "unity",
"path": "./Library/EditorInstance.json",
"request": "launch"
},
]
}
CopyRights: The Post by BY-NC-SA For Authorization,Original If Not Noted,Reprint Please Indicate From 老刘@开发笔记
Post Link: Unity2021配置VSCode+EmmyLua调试
Post Link: Unity2021配置VSCode+EmmyLua调试