Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Intellisense Not Working with Visual Studio (Fix)

Discussion in 'Code Editors & IDEs' started by DavidG_Fenex, Feb 27, 2020.

  1. Frutti7

    Frutti7

    Joined:
    Feb 28, 2023
    Posts:
    1
    Thank you so much...
     
  2. TheIronHobo

    TheIronHobo

    Joined:
    May 7, 2013
    Posts:
    4
    Thank you!!! Worked exactly like you said.
     
  3. etlanier

    etlanier

    Joined:
    Mar 9, 2023
    Posts:
    4
    you are my actual hero, thank you so much for posting this solution for everyone to use
     
  4. erikobob

    erikobob

    Joined:
    Jul 1, 2017
    Posts:
    3
    Thanks, This helped me a lot.
     
  5. Daniel-F

    Daniel-F

    Joined:
    May 15, 2013
    Posts:
    26
    This helps for Unity classes, but if you'd also like full IntelliSense information for standard non-Unity C# classes, see this thread.
     
  6. soudasuwa

    soudasuwa

    Joined:
    Mar 17, 2023
    Posts:
    1
    Many thanks xD
     
  7. LegolAragorn111111

    LegolAragorn111111

    Joined:
    Mar 30, 2023
    Posts:
    1
    you are the one of real heroes . Thank you
     
  8. Joni_Apple

    Joni_Apple

    Joined:
    Mar 31, 2023
    Posts:
    1
    Thank you so much!!! This was a perfect. Just for newer verisons you have to check every box and then hit regenerate Project files.
     
  9. terresquall

    terresquall

    Joined:
    Mar 2, 2014
    Posts:
    29
  10. ajit_singh

    ajit_singh

    Joined:
    Oct 2, 2020
    Posts:
    4
    If anyone trial all methods and if issue still exits let me share all the steps at once :
    Method 1 : Change external editor to Visual Studio in Unity preference.
    Method 2: Install Visual Studio using Unity hub/assistant.
    Method 3: Update visual studio in Unity Package Manager
    Method 4: Downgrade Visual studio version from package manager
    Method 5: If all above steps got followed and not worked, create a new project and open a script from it in Visual studio.
    Check if intelligence is working then open original project scripts and check. Intelli sense should work. In any case if it did not work then check Solution Explorer in Visual studio, you may see unsupported assembly. Just reload project from visual studio. It will the issue.

    I hope it will helps .
     
  11. Ghosted_Gamer0

    Ghosted_Gamer0

    Joined:
    Apr 26, 2023
    Posts:
    1
    It worked, Thank you so much!
     
  12. Witching-Hour-Interactive

    Witching-Hour-Interactive

    Joined:
    Aug 1, 2022
    Posts:
    1
  13. Zaitoichi

    Zaitoichi

    Joined:
    Jul 23, 2020
    Posts:
    2

    THANK YOU!
     
  14. vaad2

    vaad2

    Joined:
    Apr 30, 2023
    Posts:
    1
    love you mane
     
  15. notneo666

    notneo666

    Joined:
    Jan 17, 2014
    Posts:
    1
    worked like a charm thanks alot
     
  16. GarbageHaus

    GarbageHaus

    Joined:
    May 1, 2023
    Posts:
    5
    [Another Thank You Here]!!

    I might add that I had to go to "Open C# Project" for it to actually display the full directory on the right tab's "Solution Explorer". Then it asked me to allow Visual Studio Community through the firewall and after allowing, Intellisense began working as expected.

    Much smoother than the ~6 hours spend trying to get VSCode to work.
     
  17. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,035
    Wanted to add there is another potential problem that can cause this, that I've not seen mentioned elsewhere and that is file path length limits ( at least on Windows ).

    It would appear if any file path in the csproj file exceeds that limit ( approx 255 characters ) then Visual Studio can fail to find/load any of the references of the csproj. Without the references Visual Studio has no knowledge of Unity types and so intellisense breaks ( as well as other things ). The only warning you get for this is a tiny red stop symbol on the Solution and Projects in the solution Explorer and that if you explorer the references for a project in the explorer you'll see yellow exclamation triangle warnings.

    Unfortunately with Unity's move to packages and embedding them within the projects Library/PackageCache folder you'll be surprised just how easy it is to hit that 255 character limit. For example

    D:\Projects\Unity\Repositories\MyCoolProjectRepositories\AnotherLongName\YetAnotherLongName\UnityProjectFolderName
    This path to a project is only 114 characters, and while rather silly with folder names, is not that uncommon a length. Looks fine doesn't it, no way that can cause a problem its under half the path limit!

    Nope, because in this case project uses Entities package, which can result in a path in csproj reach 270 characters!

    D:\Projects\Unity\Repositories\MyCoolProjectRepositories\AnotherLongName\YetAnotherLongName\UnityProjectFolderName\Library\PackageCache\com.unity.entities@1.0.0-pre.65\Unity.Entities\SourceGenerators\Unity.Entities.SourceGen.SystemGenerator.EntityQueryBulkOperations.dll

    and this would appear to break Visual Studio without any useful warning.

    So if you've exhausted all the other fixes, or perhaps before you even try them, it might be worth quickly checking the path length of your project, or better yet open up the .csproj files in a text editor and browse through looking for very long path names. There are online tools that can do character counts on text, so its simple to check any path names that look too long to see if they exceed approx 255 ( I'm not sure the exact character limit, it might be a few less )

    Edit:
    Reading up on long file paths it may be solvable from Unity's end if they encoded pathnames using the extended-length path, use the "\\?\" prefix, though my understanding is that Visual Studio would have to support using unicode versions of IO API.

    Alternatively Win 10 and above can be set to support long path names via regedit, though that solution is machine specific so maybe not as useful.
     
    Last edited: Jun 10, 2023
  18. CRISTALSONIC

    CRISTALSONIC

    Joined:
    Sep 22, 2016
    Posts:
    136
    how can i try that ?

    I am running out of things to try
     
  19. CrioBlin

    CrioBlin

    Joined:
    Feb 16, 2017
    Posts:
    1
    It just works, thank you)
     
  20. HappyPumpkin13

    HappyPumpkin13

    Joined:
    Jun 2, 2014
    Posts:
    2
    Can't tell you how many times I've used this. Maybe one day I'll remember where to find the menu options, but it's not intuitive. Thanks!!
     
  21. kush24

    kush24

    Joined:
    Jan 30, 2020
    Posts:
    2

    Thanks a ton, it worked even on Unity 2020 LTS and Visual Studio Community 2022. They really need to fix this issue.
     
  22. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,711
    You need to be able to replicate a bug to be able to fix it. Some people have the bug happen every once in a long while, some people have it happen frequently, and some people like myself have never seen the bug in our entire history of using Unity. I've used VS, VS Code, and Rider, and only VS Code has done it. It's really weird.
     
  23. unity_03E00F274F82BF02BE5E

    unity_03E00F274F82BF02BE5E

    Joined:
    Jul 10, 2023
    Posts:
    1
    thanks god F*** the mono, i was struggling about my fcking .csproj not loaded and found out that I didn't download mono framework

    always remember get everything u need before starting ur project!!!
     
  24. Nexiso

    Nexiso

    Joined:
    Aug 1, 2023
    Posts:
    1
    I having a problem regarding all the fixes above. Intellisense won't work for other stuff than keywords, while I got everything checked to be normal. Anyone with an idea? (Using visual studio community).

    All text is white and compiler works fine.
     
    Last edited: Aug 1, 2023
  25. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    833
    seems like the latest version of C# plugin for VScode doesn't work with .net 4.7.1

    this fix worked for me: open vscode > click on extensions tab > c# > Uninstall dropdown arrow > Install another version > pick any version other than the newest one (I'm using 1.26.0 which seems to be stable)
     
    ThreeeDeee likes this.
  26. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    If you are using the new Unity VSCode extension, you should NOT downgrade C# extension.

    We have a dedicated thread here:
    https://github.com/microsoft/vscode-dotnettools/issues/329
     
  27. Aekila

    Aekila

    Joined:
    Sep 27, 2023
    Posts:
    2
    Thank you so much !
    It was so annoying to see red errors everywhere on my unity .cs files inside Visual Studio.

    It seems that the error appeared after my Unity Project had to reimport all assets, following the install of an Unity package.
    My setup :
    - Microsoft Visual Studio Community 2022 (64 bits) - Version 17.7.4
    - Unity 2022.3.10f1

    Following your steps, I found a slightly simpler solution (assuming step 3 is properly setted) :
    Step 1) close only one of all the files that got a similar issue inside Visual Studio, then close Visual Studio
    Step 2) open the file you closed from Visual Studio, from Unity

    Step 3 was already ok for me, and I didn't have to make any changes in Step 4: the first two boxes checked by default were fine.
     
  28. kwcnasa

    kwcnasa

    Joined:
    Aug 16, 2023
    Posts:
    1
    Fix for Unity Intellisense Not Working in Visual Studio (Unity Tutorial) by Ketra Games (youtube channel)
    <
    >
    This method works on Unity version 2022.3.7f1 with Microsoft Visual Studio version 17.7.6 as of today 2023OCT29.
     
  29. Millenium7

    Millenium7

    Joined:
    Jan 19, 2023
    Posts:
    1
    I have an issue with intellisense but its not a case of it 'not working', it does work, but its not showing ALL of the commands/parameters/etc
    i.e. if I start typing 'Physics' thats fine, but then I start typing .Ray and nothing shows up. I expect to see Raycast and other variants with help. So a bunch of commands are missing
     
  30. LingPraba

    LingPraba

    Joined:
    Nov 21, 2023
    Posts:
    1
    Step 4 made it work
     
  31. Sillesen92

    Sillesen92

    Joined:
    Jan 5, 2024
    Posts:
    1
    Thank you so much!
     
  32. The_Jim

    The_Jim

    Joined:
    Tuesday
    Posts:
    2
    You're AMAZING. THANKS.