【问题标题】:VS Code can't catch breakpoint in unity3DVS Code 无法在 unity3D 中捕获断点
【发布时间】:2020-08-08 04:09:06
【问题描述】:

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

unity ver 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# unity3d debugging visual-studio-code vscode-debugger


【解决方案1】:

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

配置完成后,你已经完成了VSCode,(更多关于配置的细节在这里提到How do I use Visual Studio Code to develop Unity3D projects in Ubuntu)你必须重新启动你的电脑。这一步没有提到。

【讨论】:

    【解决方案2】:

    确保 vs-code 是 Unity 中默认的外部脚本编辑器。转到 Edit>Preferences>External Tools 并选择 vs-code。正下方的External Script Editor Args 框应该会自动更改

    【讨论】:

      猜你喜欢
      • 2016-04-15
      • 2018-08-11
      • 2018-10-16
      • 1970-01-01
      • 2022-01-16
      • 2018-11-21
      • 2020-12-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多