Debugging Unity 3D with VS Code

  1. You must have a dotnet environment. If not, please see Using VS Code as Unity’s code editor.

  2. Install the [Debugger for Unity] plug-in
    Debugger for Unity

  3. Make sure there is no launch.json file in the [.vscode] directory, delete it if there is
    Insert image description here

  4. Switch to the debugging view on the left, click " Create launch.json file ", and select " Unity Debugger " in the pop-up menu
    step
    . If there is no Unity Debugger, you may need to run the Unity project.

  5. The launch.json file will be created after completion
    launch.json

  6. To run debugging, click the green triangle in the debugging view
    debug

  7. The debugging controller (picture below) appears to indicate success.
    success

  8. 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

mistake

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

correction

Guess you like

Origin blog.csdn.net/weixin_45345384/article/details/129210897