Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question VSCode integration not working

Discussion in 'Editor & General Support' started by ch3mbot141, Mar 31, 2023.

  1. ch3mbot141

    ch3mbot141

    Joined:
    Sep 22, 2016
    Posts:
    11
    I know this question has been asked to death but I've tried everything and I'm out of options.

    What I've done so far:
    reinstalled unity hub
    installed 2022.2.12f1
    updated project to 2022.2.12f1
    reinstalled vscode
    reinstalled dotnet sdk
    removed and readded Visual Studio Code Editor 1.2.5
    set editor in preferences to VSCode
    reset arguments
    regenerated project files
    manually deleted project .sln
    regenerated project files again
    reinstalled C# for Visual Studio Code extension
    reinstalled IntelliCode
    disabled Unity Code Snippets and Unity Tools extensions
    (only extensions enabled now are IntelliCode, IntelliCode API, and C# for VSCode)

    I've tried it all, but still no luck. There isn't any unity autocomplete.
    I heard someone had some luck downgrading Visual Studio Code Editor to 1.2.0, but I couldn't in package manager.
    Is there something I missed or should I just give up and go with visual studio 2022?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,517
    All I have is the standard blurb, which is:

    This may help you with intellisense and possibly other Visual Studio integration problems:

    Sometimes the fix is as simple as doing Assets -> Open C# Project from Unity. Other times it requires more.

    Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

    Barring all that, move on to other ideas:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/

    Also, try update the VSCode package inside of Unity: Window -> Package Manager -> Search for Visual Studio Code Editor -> Press the Update button

    Also, this: https://forum.unity.com/threads/no-suggestions-in-vscode.955197/#post-6227874
     
  3. chemicalcrux

    chemicalcrux

    Joined:
    Mar 16, 2017
    Posts:
    720
    I don't know if this is necessary unless you're specifically following these instructions, but search your workspace settings for a checkbox for "modern C#" and make sure that is disabled. I have to disable it to make code analysis work.

    Also, in VSCode, do you see something like this at the bottom left?

    upload_2023-3-31_17-18-53.png

    This means that VSCode is using the solution file. If it's not there, then it won't have any idea about what files are in your project.
     
    catblue44 likes this.
  4. ch3mbot141

    ch3mbot141

    Joined:
    Sep 22, 2016
    Posts:
    11
    Thanks, I did Assets -> Open C# Project from Unity, and followed the second link, had some good info.
     
  5. ch3mbot141

    ch3mbot141

    Joined:
    Sep 22, 2016
    Posts:
    11
    This was part of my problem. Went and disabled modern .net, still didn't work and didn't have the .sln on the bottom. After making that change though I got a different error in output, was missing .NET Framework 4.7.1. Installed that and it works now. Thanks for the help.
     
    chemicalcrux likes this.
  6. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,952
    I recommend moving to Visual Studio 2022 at some point as support for VSCode is officially deprecated now. Unity hasn't updated the package for it in more than two years which is why it's as problematic as it is. It will still work for now if you can get it to cooperate (which you appear to have done so) but it's eventually not going to work.
     
    ch3mbot141 likes this.
  7. ch3mbot141

    ch3mbot141

    Joined:
    Sep 22, 2016
    Posts:
    11
    Ah unfortunate. I use VSCode for most of my projects so I was hoping I could stick with it, but knowing it's not receiving official support I'll migrate to Visual Studio 2022. Thanks.
     
  8. cLick1338

    cLick1338

    Joined:
    Feb 23, 2017
    Posts:
    74
    Visual Studio 2022 is a heap of bloat. In my case it uses >4x the memory Visual Studio Code uses on the same project, even with tricks like disabling every feature that has a toggle. Clean installs, fast PC, gigabit connection, still bad.

    Visual Studio Code is adequately responsive out of the box (because not having typing delay is the bar VS2022 can't jump) and has every feature I need besides debugging (which Unity abandoned)

    It's a shame that the only official options are a bogged-down IDE past its prime and a recurring fee one that's not necessarily worth the money either.
     
    stonstad likes this.
  9. TheSleepyKoala

    TheSleepyKoala

    Joined:
    Aug 24, 2018
    Posts:
    24
    Try this fork out :p - https://github.com/Chizaruu/com.tsk.ide.vscode
     
    catblue44 likes this.