Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Breakpoints stopped working in VSCode

Discussion in 'Code Editors & IDEs' started by grappler, Jan 24, 2023.

  1. grappler

    grappler

    Joined:
    Jun 26, 2015
    Posts:
    13
    I'm currently using the LTS build of Unity (2021.3.17f1) and Visual Studio Code (VSCode). When I first set up the project, breakpoints were working fine in VSCode. I'm not sure what broke along the way, but here I am a few days later and the debugger isn't working. (I upgraded Unity today from 2021.3.16f1 and it didn't help.)

    Searching around, I naturally found a tonne of suggestions to fix this problem. Here are some I found that did not help with my setup:
    • Reboot and restart Unity and VSCode
    • Import all assets. Assets > Reimport All
    • Close VS. Delete Assembly-CSharp.csproj and Assembly-CSharp-Editor.csproj (this file wasn't in my project) in your project folder. Open VS.
    • Editor Attaching enabled in External Tools. This option doesn't exist in my Unity version.
    • Delete all .csproj and .sln files and regenerate them.
     
    Last edited: Jan 24, 2023
  2. anglerge

    anglerge

    Joined:
    Dec 18, 2020
    Posts:
    15
  3. grappler

    grappler

    Joined:
    Jun 26, 2015
    Posts:
    13
    I got it working by redoing some of the setup. First, I clicked on the "Run and Debug" icon in VSCode, then I clicked "create a .json launch file." After this, it prompts you for which debugger to use, so I chose "Unity Debugger." After that was all done, I clicked on Run and Debug in VSCode and the debugger started. Finally, switch to Unity and either enable debugging for the session or for all projects. After the scripts were compiled, I ran the game from Unity and the debugger was able to find my breakpoints.
     
  4. grappler

    grappler

    Joined:
    Jun 26, 2015
    Posts:
    13
    Thx. Yes, I'm hoping they realize that was a bad call and reverse course.