Ruise
Ruise

Reputation: 33

Visual Studio doesn't correspond with Unity

So, this happened a couple of days ago. I worked on a project in Unity (latest version) and Visual Studio 2017. I had to change computers/machines, so I archived the folder with the project in order to open it in the future.

The computer/machine I migrated to had last year's version of Unity and VS 2017. I updated everything, opened the project in Unity - everything was working fine. However, when I try to open Visual Studio to change the code - firstly, all lines of code are underlined red and there are many mistakes, secondly, there is no autocompletion for Unity code.

VS Issues

First of all, I tried to reinstall everything I could. I deleted both Unity and VS and installed them again. Nothing changed. Second of all, I tried reinstalling some VS versions, and both 2017 and 2019 didn't work. I even tried to change to the VSCode in Unity preferences, but no luck.

So, the question is how to fix?

Upvotes: 3

Views: 2383

Answers (1)

Daveloper
Daveloper

Reputation: 758

I had similar issues in the past. What worked for me:

1) Make sure Unity and VS are closed

2) Remove all the visual studio files from your unity project folder (*.csproj) as well as the project file (.sln)

3) remove the Library/Temp folders

4) Start your project in Unity

5) Open a .cs or .js file from within unity by double clicking it.

Visual studio will take slightly longer to open since it's going to re-create all the VS project files, but hopefully you get no more invalid compiler errors, and autocompletion works again.

Hope this helps

Upvotes: 6

Related Questions