-
You must have a dotnet environment. If not, please see Using VS Code as Unity’s code editor.
-
Install the [Debugger for Unity] plug-in
-
Make sure there is no launch.json file in the [.vscode] directory, delete it if there is
-
Switch to the debugging view on the left, click " Create launch.json file ", and select " Unity Debugger " in the pop-up menu
. If there is no Unity Debugger, you may need to run the Unity project. -
The launch.json file will be created after completion
-
To run debugging, click the green triangle in the debugging view
-
The debugging controller (picture below) appears to indicate success.
-
If the following error dialog box pops up during startup, open the launch.json file, delete the absolute path and keep only Library/… , as shown in the second picture below
If you look at the error carefully, you can find that there is a repeated path in the error ("/home/..." and "/home/..." in the above picture are the same), so delete the repeated part in launch.json