Unity3d 2020.2.0b7
When I press Attach in Visual Studio the small windows popup with title “Select Unity Instance” unfortunately it is empty making it impossible to debug.
This started after upgrade from 2020.1, previously was working fine.
Unity3d 2020.2.0b7
When I press Attach in Visual Studio the small windows popup with title “Select Unity Instance” unfortunately it is empty making it impossible to debug.
This started after upgrade from 2020.1, previously was working fine.
Did you solve this issue? If not, I’d love to help resolve it.
Partially:
I’m using:
unity3d 2020.2.0b7.3288
VS Community 2017 15.9.18
I have just realized that when I run Unity3d as administrator than I can attach debugger.
Is this related to firewall ? Should I open some ports, and what ports are needed ?
It’s possible, the debugger is a tcp connection IIRC.
You shouldn’t need to do anything explicitly, unless there was a rule created in the past - possibly by mistake. I would check your Windows Firewall settings and look for any rules for Visual Studio Tools for Unity or Unity in general and see if anything is blocked/denied.
Also, I recommend updating to Visual Studio 2019 for the most up to date improvements on the Unity experience in VS. VS 2019 can be installed along with 2017, so you can keep both if you prefer.
It looks like I was prematurely happy since it attached once.
But right now even when I run as administrator I still cannot attach.
Ok, at least things are consistent.
Let me know if you find any firewall rules defined. Additionally, it’s worth checking if the Unity Editor is correctly setup to use Visual Studio.
Make sure that the Visual Studio Editor package (use the Package Manager) is up to date with version 2.0.3 and also check Preferences > External Tools and verify that Visual Studio is selected as the external editor. In that menu, you can also click the regenerate project files button.
Already had all Visual Studio related packages updated.
Also when I double click script in unity3d it opens in VS so it looks like it is set properly.
Did you confirm if the package was up-to-date and that it’s explicitly set as the External Tool? There are other ways the script could open in VS even when not set.
You shouldn’t see a dialog to select Unity instances when you click the Attach to Unity button in the VS toolbar. That dialog would only appear if you select the Debug > Attach Unity Debugger menu item.
After regenerating the project I was able to debug.
But then I got the unity crash and when going back to project I was not able to attach even after regenerating it for the second time.
So I guess this has nothing to do with firewall.
VS is set es external editor and Visual Studio Editor v2.0.3 enabled.
“Embeded packagess” checked
“Local packages” checked
Rest is unchecked.
Hm, the Unity crash is odd.
Are you able to try a different Unity version? The 2020.2b could be related.
Yea. A total shock. It took me completely of guard.
Upgraded unity to 2020.2.9b was able to debug once later when I have tried again this little dialog box has shown again.
Is there a way I can get the logs for attaching debugger (Unity or VS logs). It might give us some hints.
I am still on 2020.2 alpha, but this might help you.
There is a Debug → Attach Unity Debugger option in Visual Studio, there you should have an option to attach to Unity.
I have similar issue and I am using that workaround.
Sometimes I have two instances of unity (???), but you can find correct one by checking if breakpoints are active
Tried it. Did not work .
I could add here that I can attach debugger to the Unity editor fine during editor mode, but as soon as I play the game, it detaches itself. Is this notmal behaviour? Cause, it is really annoying to try and debug the initial loading part of the game because of this obvious reason.
Still happens in the last release, Unity 2020.2. Using VS2017 too. Sometimes it works, sometimes it does not. I couldn’t find the pattern. This never happened with Unity 2019.4, as soon as I upgraded the project problems arised. I don’t want to do off-topic but the other problem I’ve observed is that after executing the game a pair of times Unity starts using 30% of my CPU without an apparent reason (without playing, just idle), this happened with Unity 2020.1 too. The only solution is to restart the editor. I’ve seen also that there were 2 instances of the Unity editor in the Task manager (and I’ve seen even 3 instances of the UnityHub). Many rare things are happening.
@ThundThund
If you haven’t already, please use the Help > Send Feedback > Report a Problem menu in Visual Studio to log an issue. That will help our team track the problem and follow up.
Hi, it does not seem to be a problem in VS, in my case it just does not know to which Unity instance to connect, like when you have several Unity editors open, but in this case there are not several but just one.
@ThundThund ,
No worries, it’s best to file an issue anyway with as much information as you can provide.
It would also be worth downloading and trying VS 2019 and report if that has the same behavior. Thanks!
I seem to have the same issue after upgrading to Unity 2020.2 from 2019.x. Sometimes it works, sometimes it doesn’t. The solution seems to be to restart Unity. I’ve read that there’s a bug in vs2017 which won’t display the available instances when there’s more of them. I’m guessing here that somehow vs registers the unity instance twice (both edit and play mode?) and thus tries to show the 2 instances which triggers the other bug.
I would install visual studio 2019 but I also use it for the work I do for my employer and I already have both 2015 and 2017. I’m afraid this is going to somehow mess up my ecosystem and I’ll have to spend a few days fixing it.