Search Unity

Question How to avoid multiple Unity Instances

Discussion in 'Editor & General Support' started by dalanchoo, May 10, 2021.

  1. dalanchoo

    dalanchoo

    Joined:
    Jun 6, 2014
    Posts:
    44
    I keep encountering an annoying issue when I edit a script by double-clicking it in the Unity Editor. This will open the file in Visual Studio, launching Visual Studio if necessary. When I do this, I end up with 2 Unity Instances that I will have to choose from when I attempt to attach the Unity Debugger. I never know which Unity instance to select, and if I select the wrong one then Visual Studio will not be connected and my breakpoints will not be hit, etc.

    I am able to work around this somewhat by opening Visual Studio by double-clicking the Unity.sln file. This will open up Visual Studio and there will be only one Unity instance to select from when I try to attach the Unity Debugger. However, if I double-click a script in the Unity editor to open it in Visual Studio (which I will invariable do by force of habit), I will end up getting into the same screwed-up state with multiple Unity Instances. This will persist until I close and reopen Unity again.

    Actually, I did some experimenting and it looks like if I launch Visual Studio by double-clicking on the Unity.sln file, the first time I double-click a script in Unity, Visual Studio will be fine. The second time I double-click a script in Unity is when Visual Studio gets messed up.

    This has been happening to me for a while now, at least a year, so many recent versions have had this issue. I'm currently on version Unity 2021.1.5f1. I have Visual Studio Community 2017, version 15.9.34

    I always launch Unity from the Unity Hub, if that is relevant at all.

    Thanks in advance
    John Lawrie
     

    Attached Files: