I am following a tutorial about Unity and I see that the instructor has intellisense when writes the method's name.
However I have only intellisense with classes and variables, I mean Unity classes like Rigidbody and my own variables.
I have also read:
Autocompletion not working in Visual studio
How to enable intellisense in Visual Studio 2017 for Unity
Old question, but I had the same problem just recently.
There must have been an issue in your Assembly-CSharp.csproj or project-name.sln files. Most likely to be the .csproj file. If you take a look at it, you will see various references to .dll files.
You can tell Unity (my version: v2019.2.20f1) to create these for you by enabling Edit > Preferences > Generate all .csproj files.
1. Delete both files.
2. Enable .csproj file generation.
3. Double click on a script in Unity.
This fixed my issue.
I would really like to clear things up a bit for everyone trying to get Intellisense working with Visual Studio Code.
First of all I am writing this for Unity 2019.4.14 (edit: also for 2020.3 and 2021.3).
These are the things you MUST do for this to work:
You need Visual Studio Code (duh)
You need .NET SDK. I don't think it matters which version, latest is the best I guess. Make sure you install the SDK, not the runtime.
Check if you have .NET SDK installed by typing dotnet in the VSCode terminal.
You also need The .NET Framework Dev Pack because otherwise VSCode is going to be throwing this error:
The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application.
In VSCode search for the 'C# for Visual Studio Code' extension and install it
In Unity go to Package Manager and install Visual Studio Code Editor. This will enable Unity to generate proper project files for VSCode. (might be already installed)
In Unity go to Edit -> Preferences -> External Tools and choose VSCode from the dropdown (could be listed as code.cmd) and after you choose it tick all the checkboxes you want in the Generate .csproj files for section. I checked Embedded Packages, Local Packages, and Packages from unknown sources. Click 'Regenerate project files'
Open any C# file from Unity and you should be good to go. (you might need to restart VSCode after regenerating project files in order for this to work)
Now, what about Unity Code Snippets and Debugger for Unity extensions? Well these are useful helper extensions but they have nothing to do with Intellisense. The first is for quickly typing common Unity patterns and the second is for showing Unity Debug warnings and errors as you type instead of saving and going back to Unity and reading the console.
Hope this was of any help.
p.s.
One more note: Visual Studio Code depends on the solution files we generate through Unity for Intellisense to work. This is important because you have to add the entire project folder to VSCode workspace and not just Assets folder or your Scripts folders. If you add only the Assets folder to VSCode it won't be aware of those solution (.sln) files. If you open scripts through Unity it will probably work regardless.
Although the answer by Alex Myers is helps, its not 100% right. Unity Snippets does give you some snippets, and the illusion of typeahead, it's not actually intellisense.
For true intellisense you need to:
install dotnet on your system (https://code.visualstudio.com/docs/languages/dotnet) and,
install the dotnet extension for VSCode (https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp)
More information can be found here: https://code.visualstudio.com/docs/languages/dotnet
You can test you have dotnet installed by typing dotnet into the terminal within VSCode.
Note In the image below how I get a full method signature, reference counts, and the yellow hint globe. These are only available when using dotnet + extension (and not available when using the snippets)
Note: my solution does not solve intellisense to function names, but this was the first question that come in fixing intellisense more generally in VSCode.
I needed to update the VSCode package in unity.
In Unity, click Window, then Package Manager, then look for Visual Studio Code Editor. Expand it by pressing triangle, and upgrade to the latest version (for me, it was 1.2.0. I restarted VSCode and it worked.
v1.1.4 had a bug that caused this problem, and was not fixed for about 3 months. It is still the default package installed with a new default project, so you have to change this package version to 1.2.0 in every new project, until they update it.
Check out the guide for Unity Development with VS Code. They recommend a few extensions:
Unity Snippets
Debugger for Unity
Unity Tools
I believe the Unity Snippets extension is what you are looking for.
For anyone having the same problem on a Mac, try setting this value in your .vscode/settings.json (or in the user settings instead of the workspace settings)
"omnisharp.useGlobalMono": "always"
For me just in Unity, Edit/Preferences/External Script Editor, and changed it to My_Install_Location\Microsoft VS Code\Code.exe (maybe hit Regenerate Project Files)
Sorry, I don't have good English, but I'll show you what worked for me.
I opened the C # script in Visual Studio Code and looked for the Assembly-CSharp.csproj file, then, on line 16, I changed the following:
<TargetFrameworkVersion> v4.5 </TargetFrameworkVersion>
For:
<TargetFrameworkVersion> v4.5.1 </TargetFrameworkVersion>
This solved the Intellisense issue.
Intellisense is a pure workflow of .Net Environment. So, you need to have .Net 'Developer pack' (not Runtime) installed on your system as it installs all three necessary components below:
.Net framework
.Net Target pack
.net SDK
reference link: https://dotnet.microsoft.com/download/visual-studio-sdks
It is directly installed to a system admin-accessible path, so no need setting it up. Now, you have to tell VS Code which .Net version to use (whichever you have installed).
Your Unity project will have these two files in the root directory:
Assembly-CSharp.csproj
Assembly-CSharp-Editor.csproj
In these both files search for line (probably 16):
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
Edit version that you had just installed (I had 4.8). Then reopen VS Code. Now everything should work fine.
I found another solution since none of the other solutions were working for me and i was searching for hours.(07/08/2021):
I got the feeling i found the solution for a lot of people since i reinstalled windows recently and simply downloaded everything needed to start without other problems.
I got the same error with .NET, .NET Core or .NET Framework, here are some screenshots of the errors:
In the error output, it says to install the Developer Pack for this framework version. You can find the version in the .csproj file:
By installing the .NET Framework of this version on the dotnet microsoft site: .NET Framework download list
i fixed the error after reloading VSCode and got my Intellisense working for Unity.
TLDR:
My fix was too install .NET Framework version 4.7.1
If you still can't enable IntelliSense, make sure you have VS Code opened in the same directory as the .sln file (I had mine opened deeper in the Assets before).
Source:
https://code.visualstudio.com/docs/other/unity
Though the question is 2 years old, the problem pops up occasionally, just like happened to me.
I had the issue myself, so this one is possibly the first that should be checked.
"Install .NET Framework 4.6 Targeting Pack"
WHY?
First of all, I work with dotnet core, not the standard, so I don't have standard libraries installed on my computer. When I started trying Unity, and VS Code with it, this was the missing part I wasn't aware of.
When I hit the issue, I searched the net a while and see this question. Took me another while to notice this framework sentence in "Enabling code completion" section of VS Code and Unity page. So I tried and now I am happy I tried.
Just don't forget you need to restart at least VS Code to get the intellisense working.
PS: Framework version may, and will most possibly, be changed depending on what year we are in, and which versions we use. So if "4.6" is not working then you probably need another version.
PS2: If it is Mac you are looking for, follow the same link above and find the same section I mentioned above to get a link for .NET SDK.
Follow these steps:
Go into your Unity project.
Go to Edit.
Go to Projects preferences.
Go to External tools.
In line "External Script Editor" you have to change to "Visual Studio Cummunity 2019..."
then it should work.
I have installed VS 2017 and I am sure all features related to.Net Framework, Core, C#, and ASP.NET are installed with others.
All I do is create a new project (.net standard class library) then the dependencies section is showing the warning (yellow triangle) sign. When I click on the dependencies visual studio freezes and close. If I try to work with any library I get the same error
cannot resolve symbol
Any ideas please?
When I try to build the solution, I get the following error
EDIT
I have also checked NuGet Package manager and found that the available source looks like below
Well, What I am going to say will sound CRAZY, but it is a fact and known issue and really hard to be found.
The problem is in the project path, the path for the project I have created contained a special character c:/users/Hussein Khalil(XXX)/PROJECT_NAME
when I created the project on a simple path c:/test/... everything is worked fine.
Hope this could help.
I faced the same issue and it was not related with special characters in project path.
I executed "clean solution" and then "build solution" and it restored the dependency successfully. It solved the issue.
I know there is plenty of question on that subject, but I didn't find any useful answer about my problem.
I got a project from a co-worker using mercurial. Now when i open the project I cannot open any C# file and I get the following message:
Could not load file or assembly, 'Microsoft.MSXML, Version =8.0.0.0,Culture = Neutral, PublicKeyToken=b03ff5f7f11d50a3a' or one of its dependencies. The file specified is unfindable.
Any idea? I don't know exactly what is in the code, in fact I've never see or programmed the code until now, but I know the code is working and my co-worker manage to make a installer and the software is working fine.
Try to install Microsoft Core XML Services to solve this problem
There was a problem inside Visual Studio 2010.
My resolution was:
I tried to create a basic C# applicaiton but the same error message pop-up
I tried to re-open a old project that I used to work on but the same error message pop-up.
So I used the following utility. I made a fresh install and how everything is working. I don't think it is the most efficient solution , but it worked.
Simply delete all folders in this path then rebuild your project.
C:\Users\'username'\AppData\Local\Temp\Temporary ASP.NET Files\root
I have followed the posts on this, but i am still not getting a few steps. I am new to C#, and that is probably the issue. I would love a little help (I have been banging on this all day).
I can open the FreeImage.NET solution (Win7 64 bit machine btw) in Visual Studio. This post says i need to Build it to get the C# dll. When i build it, i get hundreds of errors "type or namespace 'Name' could not be found".
Does it need the C++ DDL added first? I dragged and dropped it onto the solution, but still the errors.
Am i doing something simple and wrong?
Specifically what i am trying to do is add FreeImage to project in C# Visual Studio Express 2012.
Thanks,
Dan
After downloading the version of FreeImage.NET , I opened the following VS2005 Solution File in VS2012.(Thats the only one I have)
FreeImage3154\FreeImage\Wrapper\FreeImage.NET\cs\FreeImage.NET.2005.sln
After upgrading the project and building it for the first time, I saw around 491 errors. If you open the references of the UnitTest.2005 project, you will see that the nunit.framework assembly is missing. If you have nuget installed , in VS2012 you can
Right Click references > Manage NuGet Packages > Search for NUnit and install it.
In the image below we see that the nunit.framework assembly is correctly linked.
After doing this there were only 50 errors remaining and they were all because the Xml Documentation file checks were enabled. You can disable this check as shown below in the Library.2005 project.
Build again, and it should succeed.
NOTE: The FreeImage website provides only a 32-bit version of the DLL, thus to use this DLL you will have to ensure that you set your project version to 32-bit. To obtain a 64-bit version of the FreeImage DLL you will have o download their source code project and manually do a 64-bit build as show in this blog.
Hey everyone, I'm currently having difficulty adding the latest taglib-sharp solution to my current solution which contains my vb.net console project on Visual Studios 2010. Essentially I want to code everything necessary in vb and use taglib-sharp to extract all tags needed from an mp3 file. Unfortunately, when I include the solution of taglib-sharp and perform the necessary conversion visual studios 2008 to 2010, I receive an error stating "Failed to backup file as C:\temp\taglib-sharp-2.0.3.7-windows\taglib-sharp-2.0.3.7-windows\Backup1\taglib-sharp.snk". I made an attempt to build the solution with no luck. How do I resolve this?
To be quite frank I'm not sure if I need to open the solution if I just want to use the libraries for my vb program. Do I need the solution in order to use for instance "TagLib.File"?
In case you're wondering, I downloaded this library from http://download.banshee.fm/taglib-sharp/2.0.3.7/
I would recommend installing taglib-sharp with NuGet. NuGet is the best and easiest way to use opensource libraries in Visual Studio. You dont have to compile anything, and you don't need to think about projects and solutionfiles.
To install TagLib#, run the following command in the Package Manager Console in Visual Studio.
PM> Install-Package taglib
The NuGet distribution of taglib-sharp can be found at http://nuget.org/packages/taglib. The official source code repository is at https://github.com/mono/taglib-sharp.
Either ignore the backup, or open TagLibSharp in 2008, compile the DLL and then reference it in your 2010 project if you only need to use the libraries.