So I just downloaded unity and was watching a tutorial and they double clicked a ‘C# Script’ asset and “Visual Studios” popped up and they explained that it downloads WITH unity. but when i double click the assest it windows says “how do you want to open this file (.cs)”
Do I have to download something else or am I doing something wrong.
Every time I download Unity, for some reason I need to tell it to use the Visual Studios instance. I think that is because I already have Visual Studios, and don’t download it along side Unity. But you can tell it to use Visual Studios by going to Edit > Preferences > External Tools and select the Visual Studios instance you want C# files to open in. I am pretty sure this is the problem you are having, as I’ve had it before. That should fix it.
Click “Browse” and go to your programs folder, and look for the VS executable. Select that, wherever it may be. Google for where the .exe is stored, if necessary.
Check if you have Visual Studio set to run as administrator from the troubleshoot compatibilities. Go to C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE and look for devenv.exe → Right Click → Troubleshoot Compatibilities → Troubleshoot Program → check if the checkbox “The program requires additional permissions” is checked. If it is, uncheck it, finish the troubleshooting, and that should do it.
I had Visual Studio installed before installing Unity. And for my job i’m doing a lot of debugging with it, so I set it up to “Run as administrator” from Troubleshoot Compatibilities. As soon as a realized, i unchecked it and mira-magically it works (mentioning that i’ve been struggling with this for a couple months now). Now i run it as an admin just from the shortcut, not from any place.
Hope it works for you as well.
I can confirm that this fixed my issue with opening VS.
I had set it up to be opened by default as administrator, once I removed that setting, Unity was able to launch and synchronize with visual studio.
Note, if you look under devenv.exe properties, run as admin will NOT be checked, this is a hidden setting that is changed by the troubleshooter as explained above.