Visual Studio Debugger isn't attaching most of the time

Visual Studio can’t attach because connection is refused to: 127.0.0.1:56292.

But the port is free. This is happening randomly. What can I do?

Made it work, here are my steps:

  • preferences > external tools > click “regenerate project files”
  • restart Unity (that was the important part)

In general make sure debug is set:

  • preferences > general > code optimization on startup > debug

Why the restart of Unity was necessary I have no idea

VS just sucks when developing for Unity. Rider rules! :wink:

Seriously I know ALL of these issues and it‘s been like that five years ago! You won‘t look back.

That might be, but I’m not going to enter yet another subscription