Breakpoints stopped working in VSCode

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.
1 Like

The link you provided sends me to the onboarding page for Blogger instead of anything about VS Code and Unity.

Anywho, you may want to know that VS Code is no longer supported for Unity development . So I wouldn’t get my hopes up for any fixes.

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.

Thx. Yes, I’m hoping they realize that was a bad call and reverse course.

1 Like