首页 > 解决方案 > VS Code 无法在 unity3D 中捕获断点

问题描述

一般来说,当我想调试时,我只需要设置断点,在 VSCode 中运行调试,然后在 Unity3D 中进入播放模式,如果它捕获任何断点,Unity3D 将暂停并导航到 VSCode 中的断点。但最近,我不能再这样做了。

这个问题出现在统一版本 2019 和 2020 中,我认为问题不在于我的编辑器,而在于我的 VSCode 和一些配置,但不知道如何解决。当我在 VSCode 中运行调试时,它仍然在调试控制台中附加了 Unity3D,在 google 上搜索了一些提示但没有解决问题。即使我创建了一个新项目,但它仍然无法正常工作。非常感谢任何提示。

这是我的 launch.json 文件

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
        "name": "Unity Editor",
        "type": "unity",
        "path": "/D:/WecoApp/WecoAppLocal/Library/EditorInstance.json",
        "request": "launch"
    },
    {
        "name": "Windows Player",
        "type": "unity",
        "request": "launch"
    },
    {
        "name": "OSX Player",
        "type": "unity",
        "request": "launch"
    },
    {
        "name": "Linux Player",
        "type": "unity",
        "request": "launch"
    },
    {
        "name": "iOS Player",
        "type": "unity",
        "request": "launch"
    },
    {
        "name": "Android Player",
        "type": "unity",
        "request": "launch"
    },
    {
        "name": "Xbox One Player",
        "type": "unity",
        "request": "launch"
    },
    {
        "name": "PS4 Player",
        "type": "unity",
        "request": "launch"
    },
    {
        "name": "SwitchPlayer",
        "type": "unity",
        "request": "launch"
    }
]

}

标签: c#unity3ddebuggingvisual-studio-codevscode-debugger

解决方案


这个答案与 Ubuntu 20.04 LTS 环境的相同问题有关。

配置完成后,您已经完成了 VSCode,(有关配置的更多详细信息,请参见如何在 Ubuntu 中使用 Visual Studio Code 开发 Unity3D 项目)您必须重新启动 PC。这一步没有提到。


推荐阅读