Unity Hub and VSCode Debug

Hi there,
First of all, thanks for useful tool. It’s help me very much.

When I use VSCode to debug my game, VSCode detect Unity and Unity Hub like a Editor
This is error: Multiple targets with name ‘Unity Editor’ running. Unable to connect.

Any idea to pass it?
Thanks and best regards.

Hi,

Thank you! We hope you enjoy the tool.

As for the VSCode issue, we will investigate the problem. Which version of Unity/VSCode were you using when the problem occurred?

Happening to me with 5.6.5.p1, vscode 1.19.3. If you attach via the command palette you I get a drop down like this:

Unity Editor (Unity)
Unity Editor (Unity Hub)
Unity Editor (Unity Hub)
Unity Editor (Unity Hub)

To get around it on windows you have to kill the process from task manager even after you close Unity Hub.

Cheers.

Thanks! We will look into it.

if any others have the same problem you can fix it with changing you launch.json file in the .vscode folder so instead of the first part of the configuration begin

{
“name”: “Unity Editor”,
“type”: “unity”,
“request”: “launch”
}

to

{
“name”: “Unity Editor (Unity)”,
“type”: “unity”,
“request”: “launch”
}

5 Likes

This didn’t work for me on MacOS, I still get the same error.

Hi,
We are working on a solution. There will be an update on the “Debugger for Unity” VS code extension.
Stay tuned!

3 Likes

I was getting the same error on Windows 10, Unity 2017.3.0p4.

Making that change to launch.json fixed it for me until the extension is updated.

Has this issue been addressed at all? I am having the same issue in Unity 2021

Hi,
Has this issue been addressed at all? I am having the same issue in Unity 2021 [2]

I’m having this problem as well, it seems that (on Mac at least) there are constantly 2 Unity processes running, I can force quit the 2nd one without any issues but every time I press Play in the editor the 2nd unity process restarts.

1 Like

Hi reporting back in: I’m still having this issue in unity 2022.1. Is no one at unity trying to use the debugger or why is this still not resolved? I would assume not being able to easily debug your code should be a high priority issue?

Unity dropped official support for vscode. Only support VS or rider now.

Ah okay, thank you I missed that.

I’m not sure what the rationale is for dropping support for the most popular editor though.

This is where they announced it Extension deprecated? · Issue #206 · Unity-Technologies/vscode-unity-debug (github.com)

1 Like

The webpage here says:

“Visual Studio Code can be a great companion to Unity for editing C# files. All of the C# features are supported and more. In the screen below, you can see code colorization, bracket matching, IntelliSense, CodeLens and that’s just the start.”

None of that feels super deprecated to me.

I’m confused by this whole thing. I only started getting this error after updating to the latest LTS (Mac User).

Editing the .json to “Unity Editor (Unity)” did nothing for me, but opening the Command Palette in VS Code (Ctrl+shift+P) then typing “Unity Attach Debugger” got me a list of options where I could select the correct instance.
8515583--1135205--upload_2022-10-15_13-47-58.png

(After this, you should see encouraging console messages like

UnityDebug: Attached to Unity process 'Unity Editor (Unity)' (3324)
Resolved pending breakpoint at 'e:\Unity\VR2020Test\Myproject\Assets\...

) and then you can start your Unity project and hit breakpoints and stuff.

I only see Unity editor (Editor) 14500 null on those options, any idea?

You need to change path in launch.json.
Works for me.

"name": "Unity Editor",
"type": "unity",
"path": "${workspaceFolder}/Library/EditorInstance.json",
"request": "launch"
}```
2 Likes

This solved it for me!