Can't attach Visual Studio debugger to Unity 2020

The option “Attach to Unity” does not appear on Visual Studio for Mac:

Also, on Unity’s Preferences → External Tools, I don’t see a “Editor Attaching” option:

Everything was working fine a couple of days ago, and I didn’t update Unity, Visual Studio, or macOS.

Any ideas?

Environment:

  • macOS Catalina 10.15.7
  • Unity 2020.1.4f1 Personal
  • Visual Studio for Mac Community v8.7.8 (build 4)

I founded one solution which might work for all cases.

  1. Just start any version of VS separately from Unity.
  2. Open solution file which is previously generated for project.
  3. Open Unity, and double click on any script. It will be opened in VS and Attach will be there.

Note: I have project in Unity 5 and was working with VS 2017. Sln file is generated by VS 2017. And now on this way I can use VS 2019 and VS 2022 normaly.

For anyone going through the same problem, I just had to go to Unity → Preferences → External Tools → and click on “Regenerate project files”.

This thread helped me:
https://forum.unity.com/threads/cant-see-attach-to-unity-button-in-visual-studio.463530/#post-5890835