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

"void" is part of the C# language, so I would guess that visual studio isn't recognising C# at all

6 Answers

6

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)

Honestly, thank you so much ahaha, I was trying all the other fixes and this one worked!

Thank you very much this is one solved the problem.

Thank you really saved the day! Cheers!

I had tried everything else except for clicking "Regenerate project files", thanks!

Thank You!

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.

This worked for me, thanks. Visual Studio stopped recognizing unity for whatever reason, reinstalling unity tools in Visual Studio extensions didn't help, but this did.

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.

Is this what your referring to [138878-screen-shot-2019-05-26-at-113830-am.png|138878] Visual Studio was installed by Unity 2019.1.4f1 so it should have the necessary tools

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.