'VS Code IntelliSense does not work with Unity. Why?
VS Code IntelliSense does not work with Unity. Why?
I am using Unity with VS Code. When I type I do not get any suggestions which are related to Unity. E.g. I am not getting the gameObject suggested once I type this.:
Another example is that I can not go to the MonoBehaviour definition:
I saw this question. So, I checked that all of the extensions recommended in the answer are installed:
The extensions installation did not help. Could someone help with the issue, please?
I am using the Unity 2019.3.2f1.
If in Unity Editor I go to the Window - Package Manager - search for Visual Studio Code Editor I see it is there:
Actually I can not see the definition even for System. So, I believe there should be something wrong on the VS Code side:
Also, I followed the video. It did not help. Under the video there is the comment:
For anyone still cannot get the autocomplete to work, try installing the ".net framework 4.7.1 developer pack".
In my case, I am using Unity 2019.1.2, and I installed dotnet core 2.2 which comes with ".net framework 4.7.2.". Apparently Unity 2019.1.2 requires framework 4.7.1. You can find which .net framework version is required by checking the Assembly-CSharp.csproj file
I followed the comment suggestion. I checked what version is specified in my case in the TargetFrameworkVersion. It is 4.7.1. So, I downloaded the 4.7.1. While installing the version it told me that it is already installed and whether or not I would like to reinstall it. I reinstalled it and still it did not help.
Solution 1:[1]
It seems I was able to fix the issue. I went to Edit - Project Settings - Player - Other Settings - Configuration - Api Compatibility Level. Then I changed it from .NET Standard 2.0 to .NET 4.x. Then I reopened Unity, changed it back (to preserve the API restriction) and reopened Unity. And now the suggestions work as expected. Except for a few warnings I am getting on script opening (here is the question which is related to the warnings).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | qqqqqqq |






