Record the LUA Vscode configuration Unity
1. Download Vscode
2. Open Vscode, click "Extensions", enter "Luaide" here, install Luaide, restart Vscode
3. Open Vscode and click "File"---"Open folder" to load the Luascript folder of the project.
4. Click "File"---"Preferences"------"Settings", set "User Settings" and "Workspace Settings"
As shown in figure:
User settings:
{
"Window.zoomlevel": 0,
"Files.exclude": {
"**/.git": true,
"**/.SVN": true,
"**/.HG": true,
"**/cvs": true,
"**/. Ds_store ": True,
"**/*.lua.meta": true,
"**/*.meta": True
},
"Files.autosave": "Afterdelay",
"Workbench.editor.enablePreview": false,
"Luaide.modulefunnestingcheck": false,
"Luaide.luatemplatesdir": "E:/vstemplate/luaide/template",
"Editor.snippetsuggestions": "Top",
"Luaide.scriptroots": ["E:/client_u3d/slggamedev/assets/script/luascript"]
}
Note: "Luaide.scriptroots" This is the directory where the Luascript in the project
Workspace settings:
Put the settings in this file to override the default values and user settings.
{
"Window.zoomlevel": 0,
"Files.exclude": {
"**/.git": true,
"**/.SVN": true,
"**/.HG": true,
"**/cvs": true,
"**/. Ds_store ": True,
"**/.meta": true,
"**/.*lua.meta": true,
"**/.*meta": True
},
"Files.autosave": "Afterdelay"
}
5. At this point in the Luascript directory should be generated. Vscode this directory, "Launch.json" and "Settings.json" file into (or overwrite)
6. In the project's Lua starter class (e.g. my project is Gameluamain.lua) This file is added in the starter file
Local Breaksockethandle,debugxpcall = require ("Luascript/luadebugjit.lua") ("localhost", 7003)
Luatimer.add (0,200,function (ID)
Breaksockethandle ()
End
7. Replace the files in the "Plugins\slua" folder in the project with the files in the Slua-debug folder
Add "Lua_debug" to the settings of the 8.unity project, as shown in the figure: