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. Allennick

    Allennick

    Joined:
    May 22, 2020
    Posts:
    3
    This worked for me. Cheers mate
     
  2. nomix123

    nomix123

    Joined:
    Oct 29, 2021
    Posts:
    1
    You don't have to uninstall anything just follow these steps and everything will be fine:

    1. Close the Visual Studio.
    2. Open the unity Preferences from the toolbar and select the external tools.
    3. Then, External Script Editor chose (Open the file by extension) and instantly changed it to visual studio.
    4. Open your code file IntelliSense will work.
     
  3. The_Dark_Swordsman

    The_Dark_Swordsman

    Joined:
    May 16, 2020
    Posts:
    6
    This worked perfectly for me. Thank you!
     
  4. MIMI2020

    MIMI2020

    Joined:
    Oct 26, 2022
    Posts:
    1
    thank you this works perfectly
     
  5. MatiazTrote

    MatiazTrote

    Joined:
    Nov 5, 2022
    Posts:
    1
    Hello, I'm a begginer and had the same problem. What has worked for me was to:
    1. Install the C# plugin by Microsoft in VSCode.
    2. Close VSCode.
    3. In Unity, go to Assets>Open C# Project.
    After that, it opened the project in VSCode (if you have it configured in your preferences), and Intelisense started helping.

    Ex:
    Input.GetKeyDown(KeyCode. >> should give you a list of keyboard inputs.

    Simple, but maybe U don't have C# installed in your VSCode. :p

    Thank you!
    This is my first interaction in the Unity Forum!
    <3
     
    Last edited: Dec 1, 2022
  6. vijay_vardan

    vijay_vardan

    Joined:
    Dec 10, 2022
    Posts:
    3
     
  7. vijay_vardan

    vijay_vardan

    Joined:
    Dec 10, 2022
    Posts:
    3
    refer this video... This will damn sure help you!... and good luck
     
    tantx and sqwirral like this.
  8. seeeking

    seeeking

    Joined:
    Jul 31, 2015
    Posts:
    1
    In my case, disabling and enabling back C# by OmniSharp extension worked, maybe it'll help somebody.
     
  9. MurphMuffin3551

    MurphMuffin3551

    Joined:
    Nov 30, 2022
    Posts:
    1
    You are such a legend
     
    IvanRoyLoewen likes this.
  10. IvanRoyLoewen

    IvanRoyLoewen

    Joined:
    Apr 19, 2016
    Posts:
    3
    You're not wrong, that was so easy. Thanks!
     
  11. Deleted User

    Deleted User

    Guest

    I already have it and it still doesn't work
     
  12. Toonda_Byood

    Toonda_Byood

    Joined:
    Apr 26, 2014
    Posts:
    2
    how I got intellisense working on Fedora 37:

    firstly, when it wasn't working:
    already had VS Code installed from official source (from Microsoft repository). installed dotnet 7, mono-devel and mono-complete, but had no auto-completion and kept getting a message in VS Code that I don't have MSBuild from Mono. useModernNet was false, and my mono path was set.

    what i did to get it to work:
    sudo dnf remove mono-complete
    sudo dnf remove mono-devel (i had both installed and had to remove both individually)
    sudo dnf remove dotnet-sdk-7.0

    sudo dnf install mono-complete
    sudo dnf install dotnet-sdk-6.0
    in VS Code, install the older version 1.24.4 of C# (I had the newest version, a 1.25, and clicked the circle/settings to downgrade). this gives you the "use global mono" option, after restarting VS Code, and set it to always. also set your mono path (in terminal, type: "which mono" and use that output), and useModernNet to false.

    unfortunately, I had to start a brand new project as the old one still didn't intellisense (haven't consulted my magic 8 ball yet as to why, but who the heck knows, "Regenerate project files" in External Tools didn't seem to work), but a new project worked fine (just give VS Code a minute to get going after start up).
     
    Last edited: Apr 4, 2023
  13. TheSleepyKoala

    TheSleepyKoala

    Joined:
    Aug 24, 2018
    Posts:
    24
    Hey there!

    If it's not too much trouble, can you test if my package for VSCode helps solve your issue for Fedora 37?
    https://github.com/Chizaruu/com.tsk.ide.vscode

    It uses the more modern features of Omnisharp, so I'm hoping it helps solve your need to downgrade.

    I understand if you don't want to, but if you do and run into any issues, I would appreciate it if you open an issue on the repository. :)
     
  14. valiman

    valiman

    Joined:
    Apr 7, 2023
    Posts:
    1
    works for me when installing ".NET Framework 4.7.1 Developer Pack"

    i use VS Code
     
  15. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    992
    VS Code intelesense doesn't work in Ubuntu at all.
    Also when it works in Windows only your main scripts work, no other libraries or packages.

    VS Code is a joke of an IDE for the C# lang.
     
  16. pedronvitoriano

    pedronvitoriano

    Joined:
    Jan 14, 2021
    Posts:
    1
    worked for me, thanks!!
     
  17. ARandomDeveloper222

    ARandomDeveloper222

    Joined:
    Sep 24, 2022
    Posts:
    1
    i spent 1 hour trying to work on auto complete deleting practically everything related to vscode this actually works
     
  18. III111III

    III111III

    Joined:
    Nov 8, 2017
    Posts:
    12
    1) Go to Edit > Preference > External Tools
    2) Change the Externa Script Editor to Visual Studio Code
     
    the_smax likes this.
  19. LordDooms

    LordDooms

    Joined:
    Sep 20, 2014
    Posts:
    10
    Maybe this will work for some that find this thread.

    So much life wasted on this. I was having major problems with intellisence when switching projects v 2022.1.2f1. VS Code only seems to work properly if the VS Studio Package (not the VS Code Package) is installed alone.

    Sometimes intellisense worked with old cs files but not new ones.

    In Assembly-CSharp.csproj there is a problem which Framework is getting referenced. This seems to be set by ProjectCache in the Library. VS Code COM is setting to 4.7.1 or to whatever that is not supported or found by VSCode. You can't just edit Assembly-CSharp.csproj because it is updated constantly.

    \Library\PackageCache\come.unity.ide.visualstudio@
    \Library\PackageCache\com.unity.ide.vscode@

    Assembly-CSharp.csproj:
    <TargetFramework>netstandard2.0</TargetFramework> (works)
    vs.
    <TargetFramework>v4.7.1</TargetFramework> (doesn't work)


    1) Make sure Engineering package is uninstalled. You might be able to uninstall the culprit components but untested.
    2) Install VS Code package.
    3) Install VS Studio package.
    4) Uninstall VS Code package.
    5) Select VS Code in Preferences. (for whatever reason it sticks even though VS Code package is uninstalled)
    6) Select .netstandard in project settings player...
     
    tantx likes this.
  20. xxJoeyyxx

    xxJoeyyxx

    Joined:
    Mar 10, 2023
    Posts:
    1
    lifesaver, bless you
     
  21. dweekdev

    dweekdev

    Joined:
    Aug 2, 2021
    Posts:
    11
    Installing .Net 8.0 and then restarting the System worked for me. Also make sure you have .Net extension in VSCode.
     
  22. MadaleGamesCEO

    MadaleGamesCEO

    Joined:
    Nov 24, 2023
    Posts:
    4
    i have an issue where it says error aquiring .net and the intellisense doesnt work
     
  23. xdeployer

    xdeployer

    Joined:
    Sep 25, 2022
    Posts:
    12
    My suggestion would be to switch to Jet Brains Rider. You'll need to install Jet Brains Rider Editor in Unity Package Manager as well. But after banging my head against VS code I installed Rider and it just works.

    upload_2024-1-13_7-55-51.png
     
  24. khiemgluong

    khiemgluong

    Joined:
    Jan 6, 2023
    Posts:
    22
    Hey everyone, so I actually tried all the above solutions and none of them worked. But what did work for me was simply checking the Unity extension in the VSCode Extensions tab, and enabling it for the current workspace. After you enable it, a popup should appear on the bottom right asking you to restart the language server, and once you do your references will be found, and Intellisense will work again.
     

    Attached Files:

  25. TheRareStudios

    TheRareStudios

    Joined:
    Dec 25, 2021
    Posts:
    37
    But rider is like 100 But a year
     
  26. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 5, 2024
    Posts:
    482
    It's a bit more complicated than that

    first year: $149.00, second year: $119.00, third year onwards: $89.00
     
  27. TheRareStudios

    TheRareStudios

    Joined:
    Dec 25, 2021
    Posts:
    37
    I know but it is still super expensive.
     
  28. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    635
    “Expensive” varies from person to person. I don’t doubt that it doesn’t make financial sense for some, but the initial price of $15/month is around the price range of an internet streaming subscription in the USA. I don’t find that particularly outlandish, especially considering that the closest comparable product I’m aware of is Visual Studio Professional, where you can buy the 2022 edition for $500 or a subscription edition for $45/month.

    For people working with C# on a regular basis, Rider is a sensible investment that can make one’s life easier compared to using stock free edition Visual Studio or Visual Studio Code. That’s why you see Rider users suggest it to people having issues with other editors.
     
  29. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Closing this thread because it's no longer related to the original topic.
     
Thread Status:
Not open for further replies.