vscode configure unity's lua

Record the Lua of vscode configuration unity

1. Download vscode

2. Open vscode, click "Extensions" , enter "luaide" here, install luaide, restart vscode

3. Open vscode, click "File" --- "Open Folder" to load in the LuaScript folder of the project

4. Click "File"---"Preferences"------"Settings", set "User Settings" and "Workspace Settings"

    As shown:

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 is located

Work area 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 time, there should be a generated .vscode directory in the LuaScript directory, copy the "launch.json" and "settings.json" files in (or overwrite)

6. In the lua startup class of the project (for example, my project is GameLuaMain.lua), add this file in the startup 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

8. Add "LUA_DEBUG" to the settings of the unity project, as shown in the figure:

Guess you like

Origin blog.csdn.net/u011105442/article/details/77541961