How to get intellisense in Visual Studio Code for Unity functions names?
Solution 1
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.
Solution 2
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)
Solution 3
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 as it is the newest version.
These are the things you MUST do for this to work:
- You need Visual Studio Code (duh)
- The .NET Framework Dev Pac (not just the .NET core, not even the .NET core SDK, but the 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.
- Check if you have .NET installed by typing
dotnet
in the VSCode terminal. - 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.
- 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.
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 typping 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.
Solution 4
Check out the guide for Unity Development with VS Code. They recommend a few extensions:
I believe the Unity Snippets extension is what you are looking for.
Solution 5
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.
Yone
Updated on January 23, 2022Comments
-
Yone over 2 years
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
-
DCON over 4 yearsSimply installing C# extension helped me, +1
-
Ashik about 4 yearsHello there, I am having trouble understanding this solution. Delete both files means?
-
Mehmet Fırat Koloğlu about 4 yearsSorry for the obscurity. Assembly-CSharp.csproj and project-name.sln.
-
Chris Jang almost 4 years+1 This was the issue for me; I updated from 1.2.0 to 1.2.1 and that fixed the Intellisense issues for me.
-
Jon Plotner almost 4 yearsThis fixed it for me. Thank you. As of version 2019.4 the path to regenerate is
Edit>Preferences>ExternalTools>Regenerate project files
-
redcurry over 3 yearsI solved it by choosing the External Script Editor to Visual Studio (in Edit > Preferences > External Tools). The choice was "Open by file extension," and that choice didn't create the .csproj files.
-
dvlcube over 3 yearsUnity 2020.1.11f1 (with Visual Studio Code Editor 1.2.3) on Ubuntu 20.04. On vs code, I also needed to change C# extension settings: "Omnisharp: Use Global Mono" to "always", after installing latest mono on my system.
-
Terence over 3 yearsDo we need .net framework for this? As far as I know, Unity is using Mono.
-
Baboo about 3 yearsPay attention to the Dev Pack version if you dont want to waste some time like I did: 4.7.1
-
nwp almost 3 yearsThere doesn't seem to be any .Net Framework Dev Pack, .Net Developer Pack or anything similar in the VSC extensions. There is a .Net Core Extension Pack, but you said that's not it. There is a Unity Dev Pack. Is that what you meant?
-
xtreampb over 2 yearsIn newer unity editors (version 2020 at least) i had to change in the
Edit->Preferences->External Tools->External Script Editor
fromOpen By Script Extension
toVisual Studio Code
. This updated the preferences windows with more check boxes. I left them all unchecked (default). I then clickedRegenerate project files
button, -
Aleksandar Ruseski over 2 years@nwp the dev pack is not a VSC extension, it's a library of itself. here microsoft.com/en-us/download/details.aspx?id=56119
-
Aleksandar Ruseski over 2 years@Terence That's what it says in the guide for installing VSCode for Unity code.visualstudio.com/docs/other/unity
-
GoldenArcher over 2 yearsFor me, I installed C# extension, but the .net version was not correct (I had several older versions that's installed with Visual Studio). Also check the console to make sure all the versions are correctly installed.
-
asciidude over 2 yearsThis was not the author's question.
-
Thibaut Schwarz about 2 yearsokay so what is wrong with my answer? When I had the same problem I had to take these steps to finally get the autocompletion working so it can't be so wrong :|
-
strider about 2 yearsjust remember to install MonoDevelop some how
-
Aleksandar Ruseski almost 2 yearsnote to self: in case Intellisense is not working it might be a problem with OmniSharp server (dot net version or whatnot)