简体   繁体   中英

Visual Studio Code doesn't show Intellisense with Unity

I'm new to software development, just started learning C# from online courses and I really want to get into game dev. So here's my situation:

I have a very low spec laptop and I don't want to use Visual Studio, so instead I use Visual Studio Code as my code editor. I have .NET Core installed (although my understanding of what .NET is, is actually very fuzzy) and I just got started with the 2D UFO Game Tutorial on the Unity website .

Unity works fine, my scripts do as they're supposed to and I can follow the tutorials with (mostly) no issues. However, a big concern of mine is the fact that I almost NEVER get Intellisense or CodeLens, even when I have the correct using statements. This could be a problem when I need to find different methods, parameters, error messages etc. I never know when I have a method name wrong or if I don't have the correct using statements or if I'm using a reserved key word for Unity or C#.

One message I do get every time I open a script in VS Code from Unity is:

Some projects have trouble loading. Please review the output for more details.

And when I do review the output console window, I get a very long set of messages that I don't understand, you can find it here .

Looking at the document you posted on pastebin, the first thing that grabs my attention is [fail] . The very first time this occurs, on line 28 it states:

OmniSharp.MSBuild.ProjectFile.ProjectFileInfo .NET Framework v3.5 Service Pack 1 was not found. In order to target ".NETFramework,Version=v3.5", .NET Framework v3.5 Service Pack 1 or later must be installed.

Which suggests that you do not have .net framework 3.5 installed.

How to install this might differ somewhat per OS, but unity3d forums, mono .net3.5 not installed would be a good starting point for the specifics on that.

Hope the following helps:

Check if you can run "mono" on terminal.

$ mono --version

Check if you have mono installed at following location.

/Library/Frameworks/Mono.framework/Versions/Current/Commands/mono

if not, download and install mono from:

https://www.mono-project.com/download/stable/

now on terminal do:

$ brew update
$ brew cask install mono
$ brew link --overwrite mono

mono should work and so does the Omni in visual studio/code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM