Unity opens blank visual studio

I recently updated to the latest version unity after a year of absence and I now have this issue where clicking on scripts, warnings or errors in Unity opens a blank Visual studio community. Even if the solution is already opened in VS, a new blank version of VS opens.

  • I tried swapping to and from any other IDE via the preferences
  • I tried reinstalling the unity tools in visual studio
  • I tried reinstalling visual studio
  • I tried reinstalling Unity

Please do not suggest to just use the opened visual studio project. I really want to solve the issue, not work around it. I use 2018.3.0f2

1 Like

Same issue here, did you find a fix? Any script i open up just comes up blank ?

1 Like

Hey, I actually ended up just figuring it out on my end. It will open if you look at the inspector in VS and open the script you want from there.

1 Like

Same issue here. I get a blank screen. I can go find the file in explorer and open it there and it’s fine, but I can’t click any CS file from within unity and have it open properly, which is super annoying.

1 Like

When you open a script in VS minimise VS and double click on your script again. Should work

1 Like

when i open my script file a blank notepad file is opening but all other script files are opening perfectly in VS. how to retrieve my script file ?

I have a solution - This is pretty simple, way back when I installed Visual Studio, one of the first things I do is go right click, properties, compatibility and check “Run this program as an administrator” fast forward a year or so where I want to try out Unity for the first time. Launching the Unity Hub and then a new project I tried to open a script file but all that happens is visual studio opens with no project selected.

It turns out you need to have the Unity Hub and Unity Editor both also run as administrator.

TLDR (The Fix)
Set both Unity Hub and Unity Editor to “Run as administrator”, Find your shortcut to Unity (hub or not) right click, Properties, Compatibility and check “Run this program as an administrator”

If you don’t have Unity Hub skip that bit.

NB: If you use the Unity Hub you MUST set both Unity Hub and Unity Editor to run as an administrator for this to work.

2 Likes

how do i set unity hub as administrator on mac?

This worked, thanks a ton!

1 Like

Setting both the Unity Hub and the Unity client to administrator rights worked, thanks !
Just be sure to close the unity hub process from the system tray before proceeding or it may act weird :
7504235--924802--upload_2021-9-18_5-23-49.png

Setting Unity to run as admin worked for me!