Search Unity

Intellisense Not Working with Visual Studio (Fix)

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

  1. DavidG_Fenex

    DavidG_Fenex

    Joined:
    Feb 27, 2020
    Posts:
    1
    Likely, if you have appeared here to this page you are having the problem I had for the past hour or so. Intellisense is not working in Visual Studio. Well lucky for you, I figured out the solution to fix this issue after searching the entire web. So you don't have to search the web anymore, I will tell you how I fixed the issue.


    Step 1:
    Close Visual Studio

    Step 2:
    In Unity, go to Edit < Preferences < External Tools (left part of the Window)

    Step 3:
    In External Tools go to the part that says External Script Editor (this should be on which ever Visual Studio editor you are using (for me it defaulted to "Open by File Extension"

    Step 4:
    Make sure Generate all csproj files is checked, and Editor Attaching is checked

    Step 5:
    Open the C# script you were trying to open earlier

    Hope this Helps

    Currently using
    - Unity 2019.3.3f1 Personal
    - Visual Studio 2019
     
  2. Kabua

    Kabua

    Joined:
    Mar 28, 2020
    Posts:
    1
    It worked as you stated. Thank you!!
     
    sush333, fabidi, Polikuj and 3 others like this.
  3. Shaaz37

    Shaaz37

    Joined:
    Feb 19, 2020
    Posts:
    1
    It worked! Thank you.
     
    Polikuj and HasnainFareed7 like this.
  4. bennage

    bennage

    Joined:
    Jun 18, 2018
    Posts:
    1
    I need "Generate all csproj files". Thanks!
     
  5. VenUk

    VenUk

    Joined:
    Jan 30, 2014
    Posts:
    10
    Had this problem installing a fresh version with '2019.3.10f1' following this advice solved the problem. Thanks DavidG_Fenex much appreciated.
     
    HasnainFareed7 likes this.
  6. amm0nition

    amm0nition

    Joined:
    Apr 23, 2020
    Posts:
    1
    MANY THANKS
     
    HasnainFareed7 likes this.
  7. mr4039

    mr4039

    Joined:
    Sep 7, 2017
    Posts:
    1
    Solved my problem perfectly, thank you!
     
    HasnainFareed7 likes this.
  8. FBole

    FBole

    Joined:
    May 27, 2017
    Posts:
    2
    Thank you for this time save. It worked perfectly.
     
    darclon and HasnainFareed7 like this.
  9. NickJainschigg

    NickJainschigg

    Joined:
    Mar 11, 2013
    Posts:
    16
    Thanks, that worked! I'm on Mac, too.
     
    HasnainFareed7 likes this.
  10. StrugglingProgrammer

    StrugglingProgrammer

    Joined:
    Jun 19, 2018
    Posts:
    1
    Thank you so much for writing this up. This worked perfectly for me.
     
  11. R0Y_FLOYD

    R0Y_FLOYD

    Joined:
    May 1, 2020
    Posts:
    1
    Many thanks to you!
     
    HasnainFareed7 likes this.
  12. Xtendera

    Xtendera

    Joined:
    May 3, 2020
    Posts:
    6
    Dude, it actually worked! Thanks!
     
    HasnainFareed7 likes this.
  13. SpinJack

    SpinJack

    Joined:
    May 9, 2020
    Posts:
    7
    That didn't work for me... :(

    I already had Visual Studio Code selected as script editor.
    I didn't have any checkboxes selected under "Generate .csproj files for:"
    I added the checkboxes to all of them, but it had no impact when I reopened a script through Unity.

    Unity recognizes that Visual Studio Code is my External Script Editor, but intellisense in Vis Studio Code still does not recognize or provide autocomplete for Unity namespace items.

    Edit: After a bit of searching I found the solution!

    In addition to the steps listed above in this thread, there is also a Visual Studio marketplace addon that I had to install! Install the following free addon extensions from Visual Studio Marketplace. I would've provided links but the Unity Forum marks it as spam.

    Debugger for Unity by Unity Technologies
    For me, the Unity Debugger finally fixed it!

    Two additional optional Unity tools to consider installing:
    Unity Tools by Tobiah Zarlez
    Unity Code Snippets by Kleber Silva


    I installed all of the above, and I'm happy now! :)

    In my case, I just installed Unity and Visual Studio Code for the first time a few days ago and I just didn't know about the extra Unity extensions that I REALLY needed.
     
    Last edited: May 17, 2020
  14. anguyen2612

    anguyen2612

    Joined:
    May 22, 2020
    Posts:
    1
    (sorry for my english) i have been searching for this like 2 weeks, my computer for some reason keep running visual studio 2010 powershell and keep asking to reinstall which i didn't even have it on my computer, your solution works perfectly, thank you so much
     
  15. CuriousScribbles

    CuriousScribbles

    Joined:
    Jun 24, 2015
    Posts:
    28
    I seem to run into this issue more times than I'd like to recall. That said, I just upgraded to version 2019.3.14f1 and ran into this again under Visual Code.

    FWIW, I actually have the market place addons installed already as mentioned by @SpinJack. So at least for me that wasn't gonna help.

    What did work for me was simply this:
    Edit > Preferences > External Tools > Regenerate project files

    Problem solved.
     
    JashinV, gaurish69, Tidydox and 31 others like this.
  16. Masculino_DED

    Masculino_DED

    Joined:
    May 22, 2020
    Posts:
    1
    THANK YOU!
     
    GhoulishGames likes this.
  17. Ritesh-K

    Ritesh-K

    Joined:
    May 31, 2020
    Posts:
    4
    I tried all the above tricks but still nothing goes right. And by the way I'm using vscode.
    Please help me through this
     
  18. darkmask58

    darkmask58

    Joined:
    May 9, 2015
    Posts:
    25
    me too, nothing brings intelli back
     
  19. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    If you're using Visual Studio or Visual Studio for Mac with Unity 2020 and have issue like this, please try updating the Visual Studio package to version 2.0.2, which was just released. It fixes a known issue that would cause problems like mentioned here.

    You can update the package via Unity (2020+) > Windows > Package Manager, then select Visual Studio Editor and click the Update button.

    If you're using Unity 2020 with the Visual Studio Editor 2.0.2 package or Unity 2019 and still experience these issue, please let us know via the Help > Report a Problem menu from Visual Studio or Visual Studio for Mac. That will let you file an issue on Microsoft Developer Community.
     
    Kris6963, Aybaz, SKGowrob and 15 others like this.
  20. shmoo05

    shmoo05

    Joined:
    Apr 21, 2017
    Posts:
    1
    Oh my gosh you're a lifesaver! This worked for me on VS Code (mac). I uninstalled the C# extension, did the suggestions and then through unity opened the project back up, reinstalled the C# extension and now it's working. Thanks a bundle!
     
  21. kenttechnical

    kenttechnical

    Joined:
    Aug 21, 2019
    Posts:
    1
    This worked for me using Visual Studio 2019 Community Edition.

    This did not work for me using Visual Studio Code, in fact I couldn't even get the basic C# Syntax checker to work with that even once I downloaded the additional C# plugin, never-mind getting it to recognize Unity Library.

    Please note that Visual Studio 2019 and Visual Studio Code are two separate programs.

    If you're struggling, perhaps download Visual Studio 2019 and sign up for the free Community Edition, I can confirm it works using this method and if you look at previous comments, everyone who mentioned it does not work is trying this with VS Code and not VS 2019.

    Even the original poster was using Visual Studio 2019 and not Visual Studio Code.
     
    amarnathwani likes this.
  22. mp20022013

    mp20022013

    Joined:
    Jul 5, 2020
    Posts:
    1
    you saved me a lot of time!
     
  23. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    @kenttechnical

    Glad that worked for VS 2019 - and correct, this would not impact or change any behavior of Visual Studio Code.
     
    Bodkin likes this.
  24. coronaGoBRRRR

    coronaGoBRRRR

    Joined:
    Jun 5, 2020
    Posts:
    1
    Damn, finally it worked! Thx bro!
     
    John_MSFT likes this.
  25. unity_QHK6lS3eRO9dBg

    unity_QHK6lS3eRO9dBg

    Joined:
    Jul 13, 2020
    Posts:
    1
    Thank You!
     
  26. KarlKarl2000

    KarlKarl2000

    Joined:
    Jan 25, 2016
    Posts:
    606
    @Aurore @willgoldstone

    This needs to be permanently pinned in the forum thread.
     
    AdventureChick likes this.
  27. dsouzareenac

    dsouzareenac

    Joined:
    Dec 31, 2019
    Posts:
    4
    Fix in Unity Preferences works for 'Visual Studio Community 2019 for Mac'. Thank you!
     
  28. Dooberz09

    Dooberz09

    Joined:
    Jul 18, 2020
    Posts:
    1
    You the man! This was driving me crazy!
     
    sfuseronin likes this.
  29. GravByte

    GravByte

    Joined:
    Mar 1, 2018
    Posts:
    4
    Thank you so much! I was wondering why it worked fine on my laptop but not my desktop. It had been set to a different editor.
     
    sfuseronin likes this.
  30. Omnindian

    Omnindian

    Joined:
    Jun 1, 2020
    Posts:
    7
    Try the "Regenerate Project Files" button in External Tools. That worked for me. Nothing else did.
     
  31. AntonioPV

    AntonioPV

    Joined:
    Jul 20, 2020
    Posts:
    4
  32. Azulax

    Azulax

    Joined:
    Jan 9, 2020
    Posts:
    1
    Thank you so much!
     
  33. Amon

    Amon

    Joined:
    Oct 18, 2009
    Posts:
    1,384
    Just ran into this problem. I've tried all suggestions and none work. Latest version of VS Community 2019 and Unity 2020.1.0f1
     
  34. illyTheKid

    illyTheKid

    Joined:
    May 19, 2020
    Posts:
    6
    Yeah, same. Just downloaded 2020.1 and VS is not working with Unity. Tried all of the above suggested solutions
     
  35. illyTheKid

    illyTheKid

    Joined:
    May 19, 2020
    Posts:
    6
    I've deleted "Visual Studio Editor" in package manager and everything works as before now.
     
  36. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    @illyTheKid

    If you add the VS Package 2.0.2 back to the project, that should work. If it doesn't, can you please file a bug? Use the Help > Report a Problem menu from Visual Studio and include the details of what you've tried.
     
  37. Daeval

    Daeval

    Joined:
    Nov 26, 2012
    Posts:
    2
    I use Visual Studio Code and Intellisense is non-functional every time I create a new Unity project lately. The fix that I've found is slightly different from anything I'm seeing above, so I thought I'd share it in case it helps anyone else still struggling with this. (And for my own reference when I inevitably hit this again after a gap in new projects. :p)

    Prerequisites:
    I'm using Visual Studio Code with the C# extension, and have it set as Unity's External Script Editor. I do not have any Unity-specific VSCode extensions installed, but I don't think they would hurt this.

    Steps:
    1. Create and open a new Unity project.
    2. In the Project view, create a new script file.
    3. Double click on the new script file to open it in VSCode. After VSCode loads all its stuff, notice that Intellisense does not work, and close VSCode again. (This step may be unnecessary, but I do it every time out of habit.)
    4. In the Project view, right click on the script file and select "Open C# Project" from near the bottom of the menu.
    This time, when VSCode is done loading, Intellisense works for me. From then on out, I can just double-click a script to open it from the project view and Intellisense will be enabled.

    I suspect this is forcing some kind of project file reload, but I'm not sure. I'm also not sure if this does anything for "big boy" VS or only works with Code.

    Hope that helps somebody!
     
  38. TheCodingNoob

    TheCodingNoob

    Joined:
    Jan 10, 2020
    Posts:
    14
    It worked thx. i have had the problem for weeks by this point
     
  39. illyTheKid

    illyTheKid

    Joined:
    May 19, 2020
    Posts:
    6

    Yeah I've tried adding the package back after deleting it but it broke VS again when I did that. I will submit a but report.
     
    patceidt likes this.
  40. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    FML, tried using 2020.1, updated everything from VS to my bathroom tiles, nothing works.
    Unity is consistently getting harder to work with since late 2017 (i started with 5.5) and it's getting really frustrating.

    edit: downloaded 2019 LTS and it works outta the box like a charm.
     
    Last edited: Aug 10, 2020
    JonathanCel likes this.
  41. Full_Tilt

    Full_Tilt

    Joined:
    Apr 25, 2018
    Posts:
    16
    Worked for me for version 2019.2.21f1 Personal. In my case, I needed to check the box for generate .csproj files. Before that, I was seeing the "Loading" spinner and was unable to copy/paste or do anything except type into editor windows. Thank you very much.
     
  42. TheHappyCatsTail

    TheHappyCatsTail

    Joined:
    Jul 25, 2020
    Posts:
    3
    this worked wonders for me holy crap i've been working in VS for about a month now without the intelisense working properly but now its entirely fixed. i cant believe it took me this long to fix it though lol :p
     
  43. Sir_LANs-a-lot

    Sir_LANs-a-lot

    Joined:
    Aug 18, 2020
    Posts:
    1
    Was having this issue with Unity 2020.1 and VSC2019 - The problem seemed to be resolved when I went into Settings in Windows Control Panel > Apps > Programs and features > Visual Studio Community 2019 and clicked [Change]

    For some reason "Game development with Unity" was unchecked (pretty sure I ticked it previously). Ticked that to download/Install it.

    Loaded up Unity (2020.1) Went to [Edit] > [Preferences...] > [External Tools]

    Ticked one of the options under "Generate .csproj files for:" (I ticked the top option - Embedded Packages", hit [Regenerate project files], unticked it, hit the "Regenerate project files" button again and closed the Prefs dialogue.

    Double-clicked one of my scripts and VSC2019 loaded up and the Syntax Highlighting/Intellisense is now working OK.

    HTH
     
    Du-An-20, Dilo_ and larsmaxfield-tue like this.
  44. sachulsa

    sachulsa

    Joined:
    Mar 10, 2015
    Posts:
    1
    Working now. Thanks
     
    MrTroyD likes this.
  45. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,619
    Busted for me on this machine, too. Unity 2020.1.2, VS 2019 Community 16.6.3, Unity Visual Studio 2.0.2 plugin (re)installed, .csproj files deleted and regenerated, restarted both bits of software. My "Attach..." button is back, but intellisense has no idea about anything Unity related.

    Beautifully, even the Unity API Reference button in VS doesn't work. :) (It opened the ref for the wrong version of Unity, and has yet to return a single search result.)
     
  46. J69

    J69

    Joined:
    Dec 18, 2017
    Posts:
    1
     
  47. aleksipekkala

    aleksipekkala

    Joined:
    Aug 18, 2020
    Posts:
    4
    I had the same problem as everyone else, but my new problem is after changing external script editor from open by file extension to visual studio, it doesnt open the visual studio anymore when trying to script through unity
     
  48. zacharyaghaizu

    zacharyaghaizu

    Joined:
    Aug 14, 2020
    Posts:
    65
    Hi I'm also having issues with 2020. I tried choosing Visual Studio for Mac and it works. Do I just move onto that if I am developing fro android mobile apps?

    EDIT:

    I used this on another post

    "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 don't know if it is a work around or an official solution
     
    Last edited: Aug 23, 2020
    atna8410 and AreaAmos2004 like this.
  49. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,619
    It's now working, and I don't know what changed to cause that.
     
  50. John_MSFT

    John_MSFT

    Microsoft Employee

    Joined:
    Feb 21, 2018
    Posts:
    118
    @zacharyaghaizu

    Visual Studio Code does not officially have support for Unity. There are some extensions you can use to make it work. For details, take a look here: https://code.visualstudio.com/docs/other/unity

    Visual Studio and Visual Studio for Mac officially have support for Unity and is maintained by Microsoft (I am the PM on the team). This is called Visual Studio Tools for Unity and is included in the VS installer and is already built-in to Visual Studio for Mac.

    Windows: https://docs.microsoft.com/en-us/visualstudio/cross-platform/visual-studio-tools-for-unity
    Mac: https://docs.microsoft.com/en-us/visualstudio/mac/unity-tools?view=vsmac-2019
     
    geoffhin and gaous like this.