Search Unity

Intellisense not working for Visual Studio Code

Discussion in 'Code Editors & IDEs' started by stpaulgym, Jan 19, 2020.

Thread Status:
Not open for further replies.
  1. stpaulgym

    stpaulgym

    Joined:
    Sep 2, 2018
    Posts:
    4
    Operating System: Windows 10

    Problem:
    1. Intellisense and Autocomplete not working for VScode.
    2. Opening c# script within the editor opens VSCode. However, VScode Doesn't automatically open a project folder.

    Programs and program versions: Unity 2019.18f1, VSCode 14.1

    VSCode Extensions:
    1. c#
    2. Visual Studio Intellisense
    3. Unity Debugger
    4. Unity Tools

    Attempted solutions:
    1. Tested with .Net 4.6.x, .Net 4.7.x, .Net 4.8.x and same results
    2. Fully uninstalled and reinstalled VSCode as well as Unity. Same results.
    3. Followed this guide but no change.
    4. Instead of selecting the Visual Studio Code in External tools I attempted to open the code.exe file directly, no changes.
    Any Help to fix these problems would be great.
    Thanks.
     
  2. WookieWookie

    WookieWookie

    Joined:
    Mar 10, 2014
    Posts:
    35
    Same here!
     
    anycolourulike likes this.
  3. Incode

    Incode

    Joined:
    Apr 5, 2015
    Posts:
    78
    mohammadsaiif, Omid7L and rahdnus119 like this.
  4. ANS_TT_VR

    ANS_TT_VR

    Joined:
    Nov 3, 2019
    Posts:
    7
    Any solutions?
     
  5. EyeDev44

    EyeDev44

    Joined:
    Apr 8, 2017
    Posts:
    149
    Same. Hate it.
     
  6. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    440
    You need visual studio code from package manager. I wish this is included with Unity.
     
  7. paulusuluap

    paulusuluap

    Joined:
    May 12, 2020
    Posts:
    4
    Bro, i have the answer for you. the solution is super SIMPLE
    you just have to download this tool
    - Unity Code Snippets by Kleber Silva
    which you can find it on VSCode, after installing it, close the VSCode and reopen.
    That's it.

    I've been strolling to any possible solutions I could find for the same problems as yours, but the answer is just as away as your right-hand to your mouse.
     
  8. hudspeth

    hudspeth

    Joined:
    Jan 9, 2014
    Posts:
    1
    I found a fix for this in VSCode and it's only a few steps.

    Your environment in VSCode may vary, but I have all the extensions you have in the OP.

    But here's what I experience. I make a new project, after OmniSharp loads in VSCode. The packages don't highlight correctly, and I don't have intellisense. So I do the following:
    1. Go to Unity -> Edit -> Preferences -> External Tools
    2. Look for the section near the top called "Generate .csproj files for:" and click "Regenerate Project Files" with everything unchecked.
    3. Then in VSCode I press "Ctrl + Shift + P" and run the action for "Developer: Reload Window"
    Intellisense and all your other syntax highlighting should start working again.

    I hope this works for y'all. I am on Unity 2019.3.13f1

    EDIT: Removed the step to delete the Assembly-CSharp.csproj file. Regenerating it in step 2 is enough.
     
    Last edited: Jun 9, 2020
  9. sahilpant16

    sahilpant16

    Joined:
    May 21, 2020
    Posts:
    1
    I was also stumbled upon the same problem recently.

    The problem with me was that in *.csproj file it was referencing to the .net framework v4.7.1 so I simply edit the *.csproj file to v4.8 and all the intellisense were back.
     
  10. MrPaparoz

    MrPaparoz

    Joined:
    Apr 14, 2018
    Posts:
    157
    Sometimes I have this issue, also. Consider upgrading Visual Studio Code package to 1.2.0 and if omnisharp doesn't work, right click to anyplace in assets and click Open C# Project.
     
    Stanrrry, Humii and Gertbo like this.
  11. NeoElMoko

    NeoElMoko

    Joined:
    Apr 24, 2017
    Posts:
    1
  12. ElPaso

    ElPaso

    Joined:
    May 23, 2020
    Posts:
    1
    Thank you sooo much, i've try different solution but that's the only one that worked for me! ;)
     
  13. unity_Jnrav_B4WVz0Lw

    unity_Jnrav_B4WVz0Lw

    Joined:
    May 28, 2020
    Posts:
    1
    Thank you very much this worked for me. Before I did this classes like "Rigidbody", "Animation", etc. were not showing so thank you very much!
     
    Mikaeli likes this.
  14. aaronshawcsh

    aaronshawcsh

    Joined:
    May 1, 2020
    Posts:
    3
    Hey guys, my VSCode refuses to run Intellisense, I've tried absolutely everything and I am stuck. Kindly let me know what files and logs you need to see to help. I've restarted my computer, implemented all the fixes on this thread, but nothing has worked.

    EDIT: I have a Windows 10 64-bit PC, running Unity 2019.3.14f1, .NET Framework 4.8.0, .NET Core SDK version 3.1.300, Visual Studio Code version 1.45.1, C# extension version 1.22.0
     
    Last edited: May 31, 2020
    seriouslee131 and afshin_a_1 like this.
  15. dan_unity868

    dan_unity868

    Joined:
    May 30, 2020
    Posts:
    1
    I think I can help. On Windows 10 64-bit, Unity 2019.3.15f1 requires the 4.7.1 .NET Framework. You can see this in the error log:

    The reference assemblies for framework ".NETFramework,Version=v4.7.1" were not found


    Since VS Code is a text editor, it needs to have the framework locally install; having Unity open it isn't good enough. So, I needed to download the .Net Framework, version 4.7.1!

    So basically, I downloaded this and now I have Intellisense:
    https://dotnet.microsoft.com/download/dotnet-framework/net471

    P.S. You might have to restart Unity, VS Code, and your laptop.
     
  16. EyupJohn

    EyupJohn

    Joined:
    May 15, 2020
    Posts:
    1
    That's worked for me, thanks bro :)
     
    Deleted User likes this.
  17. aaronshawcsh

    aaronshawcsh

    Joined:
    May 1, 2020
    Posts:
    3
  18. aaronshawcsh

    aaronshawcsh

    Joined:
    May 1, 2020
    Posts:
    3
    @dan_unity868 it worked! I combined it with a fix which said it might be a dual drive problem (my .NET stuff was on C:\ but VSCode was on D:\) Thanks a ton for your time! Good luck!
     
  19. DatzuDev

    DatzuDev

    Joined:
    Jan 31, 2020
    Posts:
    1
    Worked for me, thanks!
     
  20. correiaN

    correiaN

    Joined:
    Mar 13, 2020
    Posts:
    1
    isso funcionou para min!
     
  21. HernandoNJ

    HernandoNJ

    Joined:
    May 13, 2018
    Posts:
    75
    Thank you very much. It worked for me.
    I had
    Code (CSharp):
    1. Assembly-CSharp.csproj ... <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
    But when checking in installed programs, I had 4.6 version in the laptop. So, I closed VS code, removed 4.6 version, installed 4.8 and changed it in *.csproj file
    Code (CSharp):
    1. <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
    4.8 version link: https://dotnet.microsoft.com/downlo...nk-you/net48-developer-pack-offline-installer
     
  22. valen308

    valen308

    Joined:
    Nov 16, 2016
    Posts:
    1
    For me, it was that I was missing a certain .NET SDK version. Check the output.
     
  23. Alf4ed

    Alf4ed

    Joined:
    Oct 31, 2018
    Posts:
    1
    Thanks so much. Been trying to work this out for ages. It was a perfect fix.
     
  24. LandonHughesLLC

    LandonHughesLLC

    Joined:
    Feb 18, 2016
    Posts:
    6
    Thank you so much!! Everything works great now!
     
  25. exjuantelleria97

    exjuantelleria97

    Joined:
    Jul 3, 2020
    Posts:
    2
    How do you do this??
     
  26. exjuantelleria97

    exjuantelleria97

    Joined:
    Jul 3, 2020
    Posts:
    2
    I just used Visual Studio 2017 and when opened the script asked me to use .NET framework version 4.6.1 and just accepted. Intellisense worked just fine. I would love to use VS Code since its lighter but whatever
     
  27. StaszekJedi

    StaszekJedi

    Joined:
    Jul 4, 2020
    Posts:
    1
    Thanks so much, it's working
     
  28. bardackx

    bardackx

    Joined:
    Jul 22, 2017
    Posts:
    1
    This worked for me
     
  29. andyd01

    andyd01

    Joined:
    Jul 20, 2020
    Posts:
    1

    This worked perfectly!
     
    yassinweaeae likes this.
  30. ja0213

    ja0213

    Joined:
    Aug 17, 2019
    Posts:
    1
    I have the new version of unity but in visual studio the transform is not coming. I have spent the last 2.5 hours on google tring many things. I have deleted all extensions and reload them I have selected VSCode directly in unity external tools. All I seem to get is the onClass intellisense. The Transform, GameObjects ect is not coming up. Even tried all the options in this string.

    I have the Unity Tools installed the current version of C# and Unity Snippets by Kleber Silva, Which seems the preferred extension. Can someone help or point in right direction.

     
  31. arcentalminitte

    arcentalminitte

    Joined:
    Jun 3, 2018
    Posts:
    2
    R0man likes this.
  32. Safwanljd

    Safwanljd

    Joined:
    Oct 2, 2019
    Posts:
    1
    Thanks, this worked for me!
     
  33. Deleted User

    Deleted User

    Guest


    This one is genious!
     
  34. socialtrens

    socialtrens

    Joined:
    Oct 23, 2017
    Posts:
    65
    This is worked for me. Thanks.

    Remember you also need to install OmniSharp (C#) add-on in VS Code. If you haven't installed it yet, install it first.
     
  35. alti

    alti

    Joined:
    Jan 8, 2014
    Posts:
    94
  36. KokodokoGames

    KokodokoGames

    Joined:
    May 20, 2014
    Posts:
    40
    I thought I solved the problem on Mac OS by re-installing the latest MONO, and then following the steps mentioned above: Regenerate projects files within Unity, and then restart VS Code.

    It went OK for a few weeks, BUT today I started a new project and now all of a sudden the problem is back, and repeating the above steps doesn't fix it...

    The assemblies for .NET 4.7.1 can't be found....
    sigh...

    How to solve this permanently?
     
    Last edited: Aug 28, 2020
    Remzinho likes this.
  37. pusa

    pusa

    Joined:
    Aug 10, 2016
    Posts:
    2
    To me I fixed this by browsing the Visual Studio Code editor in the Window/Preferences/External Tools-External Script Editor (do not select the Visual Studio Code in the dropdown menu. You must browse it)

    The Visual Studio Code executable can be found at "C:\users\{username}\AppData\Local\Programs\Microsoft VS Code\Code.exe" on Windows by default.

    It took me for like more than 4hours non-stop just to have a hunch that the problem is caused by selecting the Visual Studio Code from the dropdown menu HAHAHAHA
     
    xxJoeyyxx and SunnyChow777 like this.
  38. Urajin

    Urajin

    Joined:
    Jul 21, 2016
    Posts:
    3
    found a fix from another forum, worked like a charm:

    In Visual Studio Code, go to the Extension settings for C# Extension (just click on the cog icon), look for "Omnisharp: Use Global Mono" and change the value to "always"
     
  39. kweiko

    kweiko

    Joined:
    Mar 9, 2010
    Posts:
    103
    Thanks! Fixed it for me too. I just had to relaunch VS Code in the end for it to work.
     
  40. JohnGabin

    JohnGabin

    Joined:
    Mar 31, 2020
    Posts:
    3
    Hello,
    I resolved this issue by downgrading the "C# for Visual Studio Code" to the 1.23.0 version instead of the 1.23.2. It began to fail when I upgraded this extension.
    Click on the extension's cog and select "Install an other version..."

    And the completion, Intellisense came back.

    I'm on a MacBook Pro.
     
    Reijii, Gobius and mvoelcker like this.
  41. ytkimirti

    ytkimirti

    Joined:
    Mar 21, 2015
    Posts:
    8
    You are a lifesaver. This worked perfectly for me, thanks a lot!

    Mac OS Catalina and Unity 2019.4.3f1
     
  42. jyfc

    jyfc

    Joined:
    Feb 19, 2016
    Posts:
    9
    Here's a solution where you don't have to downgrade your C# extension:

    - go to your settings with control + , (comma)
    - set omnisharp.useGlobalMono to "always"

    If it's not working, try regenerating your project files.

    This should really be detailed somewhere officially as it's a pretty annoying issue that will probably affect a lot of people.

    I found this by taking a peek at the C# extension's changelog, where they give you this fun little tidbit:

    upload_2020-10-1_11-48-27.png

    Click here if you want to follow the progress of that issue.
     
  43. Cantuga

    Cantuga

    Joined:
    Sep 3, 2017
    Posts:
    3
    I'm gonna write this down in case someone still has problems.

    If you followed the guide from the official vscode site you will at some point download a .net targeting gimmick to make the autocompletition work.
    Except that it won't work, for all the reasons in this thread... and another one.

    The .net targeting thing you downloaded is of the wrong version.
    The vscode guide made you download the 4.6 when you actually needed the 4.7.

    Download this 4.7.1 version: https://www.microsoft.com/en-us/download/details.aspx?id=56119
    and if you followed the steps of this thread it will probably work.
     
    Carrotpie and Ensortainment like this.
  44. xgg

    xgg

    Joined:
    Dec 2, 2014
    Posts:
    1
    I found a solution for myself. Unity sets the wrong TargetFrameworkVersion in Assembly-CSharp.csproj. Change it to your version of .NET Framework. When you have changed the value, just reload VS Code, easy way Ctrl+Shift+P Developer Reload. Unity seems to reset the value on Assets->Open C# project.

    My working version is 4.6.1 which I found through Visual Studio(it gave me a warning about version discrepancy when opening *.csproj)
    https://i.imgur.com/xPBMiB3.png

    The weird thing is that registry Editor says that I have .NET Framework version 4.8.0 but I cannot get that to work.
     
    Last edited: Oct 10, 2020
    Carrotpie likes this.
  45. nanonanoatme

    nanonanoatme

    Joined:
    Aug 20, 2020
    Posts:
    1
    Thank you!!!!!!!!!!!!!!!!!!
     
  46. triangle4studios

    triangle4studios

    Joined:
    Jun 28, 2020
    Posts:
    33
    Works
     
  47. pedro_aviz

    pedro_aviz

    Joined:
    Apr 8, 2020
    Posts:
    1
    It works! Thank you!!!
     
  48. Ary18

    Ary18

    Joined:
    Dec 6, 2020
    Posts:
    1
    Worked too, thanks man
     
    deezero7 likes this.
  49. BlueHunterSV

    BlueHunterSV

    Joined:
    Dec 15, 2020
    Posts:
    1
    Thank you so much, this fix worked for me! I had the same ".NETFramework,Version= v4.7.1 not found " showing up in error log, so I installed it from the link that you've given and it worked perfectly after installing it.

    I had initially installed .Net Framework version 5.0 which is the latest version, but for some reason intellisense wasn't working. Installing .Net v4.7.1 fixed this issue.
     
  50. Ensortainment

    Ensortainment

    Joined:
    Dec 19, 2020
    Posts:
    15
    Thank you! This was the only thing that worked. There has to be a better way than manually editing the file though. smh.

    Edit: There is, just uninstalled the 5.1 or whatever .net core, and installed the v4.7.1 version instead because that seems to be all Unity exports and that seems to do the trick. Thank you for all the help thread.
     
    Last edited: Dec 20, 2020
Thread Status:
Not open for further replies.