Visual Studio is not recognizing Unity

I’ve deleted and redownloaded visual studio and Unity several times but the problem still persists. Visual Studio doesn’t recognize

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

Therefore nothing works

I currently have Unity version 2019.1.4f1. This problem started after Visual Studio update

for those who cannot solve this problem using above solutions, try this.

  1. Go to Edit → Preferences → External Tools
  2. In the Generate .csproj files for: tab, make sure “Local packages” is checked
  3. Click “Regenerate project files” button

This worked for me (unity version 2019.4)

Reinstalling the Visual Studio Editor package through Unity by “upgrading” to a previous version then upgrading again to the current version of the Visual Studio Editor package worked for me. This whole thing has happened to me on multiple computers.

Which version of Visual Studio do you have installed? Did you install the Visual Studio Tools for Unity for that version? If not, either update your installation or go to Tools > Extensions & Updates in Visual Studio, search for and install the Visual Studio Tools for Unity.

I just had the same issue. Just check for new updates from within Visual Studio – It should show a new Mono Framework (or similar). After installing this update, it should work fine again :slight_smile:

If the issue persists after updating (or the editor is already updated beforehand) you can do the following as this worked for me after I updated my project with a new version.:

  • Close visual studio
  • In your project delete the following files (or copy them somewhere else for safekeeping): projectname.sln, Assembly-CSharp.csproj and .vsconfig
  • Restart visual studio by opening a script via the Unity editor (and this should recreate the just deleted files).

And yes, this is a “have you tried restarting it?” solution but often those work.

ive been having this issue recentkly as well these are the things I can recommend.

on Unity game engine
1st Edit >Preferences > External tools, and select visual studio

2nd Windows > Package Maneger > Visual Studio Editor > Update

3rd in Visual Studio > Extensions > Unity, C#.

after doing these it usually works for me.