How do I stop the Visual Studio debugger from detaching when I launch the Editor?

I have the solution set as “Development Editor”, “Win64”, and whenever I press F5 to Start Debugging, the editor opens up with the “Choose Project” dialogue, and when choosing a project it then closes that instance of the editor and relaunches a new one with the chosen project, detaching the Visual Studio debugger.

I was able to fix this from happening by going to the Edit → Editor Preferences menu in the editor. Go to General → Loading & Saving, and choose the topmost checkbox under Startup “Load the Mots Recently Loaded Project at Startup”.

With this checkbox checked, when you start debugging the editor, it’ll automatically load the last project so the editor won’t relaunch causing a detachment.

When you open a new project it actually closes the original editor instance and opens a new one.

You can work around this by putting the path to your .uproject file (eg) “C:\UnrealProjects\MyProject\MyProject.uproject”) on the command line in Visual Studio. This will then open your project immediately and won’t require the editor to close and re-open.

Are you running the UE4 project, or your game project? Your game project should do this for you automatically.