Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Hub and VSCode Debug

Discussion in 'Unity Hub' started by seec1, Jan 30, 2018.

  1. seec1

    seec1

    Joined:
    Jun 6, 2016
    Posts:
    11
    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.
     
  2. AbrahamDUnity

    AbrahamDUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    431
    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?
     
  3. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    470
    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.
     
  4. AbrahamDUnity

    AbrahamDUnity

    Unity Technologies

    Joined:
    Jun 28, 2017
    Posts:
    431
    Thanks! We will look into it.
     
  5. EmilSVad

    EmilSVad

    Joined:
    Dec 7, 2016
    Posts:
    1
    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"
    }
     
    RG_Keith, Its4u, seec1 and 2 others like this.
  6. seffles

    seffles

    Joined:
    Oct 2, 2013
    Posts:
    32
    This didn't work for me on MacOS, I still get the same error.
     
  7. joeksy

    joeksy

    Unity Technologies

    Joined:
    Jan 12, 2017
    Posts:
    155
    Hi,
    We are working on a solution. There will be an update on the "Debugger for Unity" VS code extension.
    Stay tuned!
     
    RG_Keith, seec1 and seffles like this.
  8. MintPuma

    MintPuma

    Joined:
    Oct 30, 2014
    Posts:
    16
    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.
     
  9. pragmascript

    pragmascript

    Joined:
    Dec 31, 2010
    Posts:
    107
    Has this issue been addressed at all? I am having the same issue in Unity 2021
     
  10. cordula26

    cordula26

    Joined:
    Apr 12, 2021
    Posts:
    1
    Hi,
    Has this issue been addressed at all? I am having the same issue in Unity 2021 [2]
     
  11. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    420
    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.
     
    pragmascript likes this.
  12. pragmascript

    pragmascript

    Joined:
    Dec 31, 2010
    Posts:
    107
    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?
     
  13. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    470
    Unity dropped official support for vscode. Only support VS or rider now.
     
  14. pragmascript

    pragmascript

    Joined:
    Dec 31, 2010
    Posts:
    107
    Ah okay, thank you I missed that.

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

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    470
    pragmascript likes this.
  16. yaxamie

    yaxamie

    Joined:
    Mar 11, 2017
    Posts:
    8
    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).
     
  17. R0dluvan

    R0dluvan

    Joined:
    Nov 16, 2016
    Posts:
    10
    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.
    upload_2022-10-15_13-47-58.png

    (After this, you should see encouraging console messages like
    Code (CSharp):
    1. UnityDebug: Attached to Unity process 'Unity Editor (Unity)' (3324)
    2. Resolved pending breakpoint at 'e:\Unity\VR2020Test\Myproject\Assets\...
    ) and then you can start your Unity project and hit breakpoints and stuff.
     
  18. Pnvanol

    Pnvanol

    Joined:
    Jan 11, 2016
    Posts:
    114
    I only see Unity editor (Editor) 14500 null on those options, any idea?
     
    Last edited: Oct 28, 2022
  19. AlexGoro

    AlexGoro

    Joined:
    Mar 31, 2021
    Posts:
    1
    You need to change path in launch.json.
    Works for me.

    {
    "name": "Unity Editor",
    "type": "unity",
    "path": "${workspaceFolder}/Library/EditorInstance.json",
    "request": "launch"
    }
     
    D00MX and mihairobert466 like this.
  20. mihairobert466

    mihairobert466

    Joined:
    Oct 5, 2018
    Posts:
    1
    This solved it for me!