Search Unity

Visual Studio intellisense stopped working

Discussion in 'Editor & General Support' started by TareqProjects, Jan 5, 2017.

  1. TareqProjects

    TareqProjects

    Joined:
    Jun 27, 2016
    Posts:
    55
    Hello all,

    I am running Unity version 5.5.0f3 and had installed the Visual Studio during the installation process. I started a project some time ago using a previous version of Unity (5.4.0f3) and the C# instellisense autocomplete was working fine after conversion. However today, for some reason, the intellisense is not working. I have tried manually loading visual studios and then manually loading the .sln file but that didn't work. This problem also persists when I use MonoDevelop.

    I am wondering could the conversion have done something to mess up the intellisense? Is there a fix for this?

    Thanks,

    -Tareq
     
    Last edited: Jan 5, 2017
  2. SaraCecilia

    SaraCecilia

    Joined:
    Jul 9, 2014
    Posts:
    675
    You may have to install .NET again: In Windows, Go to Control Panel / Programs and Features / (then on the left side) Turn window features on and off / and selecting both .NET 3.5 as well as .NET 4.6. You may then also have to reboot your computer after installing. This has worked for some users, let me know if it solves the problem!
     
  3. TareqProjects

    TareqProjects

    Joined:
    Jun 27, 2016
    Posts:
    55

    I went there and noticed that both the .NET versions were unchecked. Should I check both of them and restart or leave them unchecked and install a new copy?
     
  4. SaraCecilia

    SaraCecilia

    Joined:
    Jul 9, 2014
    Posts:
    675
    Yes, check them both and see if that helps.
     
  5. TareqProjects

    TareqProjects

    Joined:
    Jun 27, 2016
    Posts:
    55
    So I checked them both and it was trying to update them. However it couldn't, and I get an error code: 0x800F081F
    I went on to Microsoft's website, downloaded their troubleshooting software that they recommended, but that couldn't identify the problem
     
  6. IvelLeCog

    IvelLeCog

    Joined:
    Dec 21, 2013
    Posts:
    1
    I am having a similar problem. I think i must be hitting some sort of hotkey to toggle the intellisense/autocomplete. Occasionally I'll be be typing a bit haphazardly and shortly after realise that the unity specific autocompletions have disappeared from the tooltip.
    Does anybody know if there is a hotkey?
     
  7. justarandomname2

    justarandomname2

    Joined:
    Jul 6, 2015
    Posts:
    5
    This happend to me today. I was creating a c# script and everything worked fine, later I created another script and somehow all of the Unity/Mono classes and the Unity message methods were not syntax highlighted. This happend to me before, when I opened a script after creating it, before Unity compiled. Then I had to rename the script to get a prompt in Visual Studio "Reload Solution" or so and after reloading, intellisense worked again. Now this time I waited for Unity to compile but syntax highlighting seems to be broken. Not even renaming script files solves the problem anymore. It is weird because since then, no matter how often I reload Unity or Visual Studio (I have the newest version for both), intellisense doesn't work anymore for the scripts I create. Yet for the script I created where intellisense was still working, well intellisense still works. But only for that file. Lol? Also in the solution explorer in visual studio, all of the c# files where intellisense doesn't work, they don't have a class in the hierarchy: Normally every c# file has the classes listed inside it when you expand it, but for the scripts where intellisense stopped working, there is nothing to expand, so not only intellisense is broken, but also visual studio itself seems to be broken. It is weird that this is not solved yet since the fact that visual studios intellisense sometimes is broken when you open scripts before Unity compiles, this has been as far as i can remember, but now that everything is totally broken and I cannot program anymore with visual studio, this is insane, really. And I am not going to reinstall those tons of gigs for Unity and visual studio (and maybe .net or maybe even Windows? ;) ) just because visual studio or Unity or whatever randomly decided to stop working and apparently I am not the only one on this and this thread isn't the only one on this topic. :eek:
     

    Attached Files:

    Rodolfo-Rubens likes this.
  8. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,334
    You can force the solution to regenerate by deleting the .sln file in your assets folder and then open the solution from Unity again. Delete all of the .csproj files while you're at it.
     
  9. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    Yep, bumping this here because I'm having this exactly same problem. Everything was fine on Windows 8.1, I had to format my PC (updated to Win 10) and installed a fresh Unity 2017.2.0f3 version and the VS Community 2017 that comes with it. Going back to MonoDevelop and there goes my productivity because I was too used to VS.
     
  10. quitebuttery

    quitebuttery

    Joined:
    Mar 12, 2011
    Posts:
    329
    OMG @Baste -- you're a lifesaver. I had this same problem (and had it on another dev machine that I had to switch back to MonoDevelop on) and your method works!!!!
     
    jpined8 likes this.
  11. EssyTech

    EssyTech

    Joined:
    Jun 17, 2013
    Posts:
    9
    @Baste answer will fix all. Thanks.
     
  12. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    @Baste's solution didn't work for me, after I create a new file, intellisense doesn't work on it also it doesn't appear on the files list in the solution explorer, I need to hit the refresh button on the solution panel...
     
  13. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    I'm having the same symptoms, probably the same core issue. If you look at the file in VS when it's open, you will see it hasn't been assigned to the correct project, it gets stuck in Misc files project which is probably some internal project that files go in when someone adds it to a solution incorrectly.

    But in any case, in VS explorer right click and exclude it from the project. Then do Project -> Show all files (it's a toggle). Now include it and it should be in the correct project and the problem is fixed. And finally Project -> Show all files to toggle it back to not showing excluded files.
     
    avant_garde and Mikael-H like this.
  14. BBB_brunoma

    BBB_brunoma

    Joined:
    Jan 10, 2017
    Posts:
    21
    This started happening to me after updating to VS2017 15.4.0
    There's a similar report on the Microsoft Dev Community forums
     
    VRtube likes this.
  15. ScottAdams

    ScottAdams

    Joined:
    Nov 23, 2016
    Posts:
    72

    Thanks @snacktime that worked for me as well! Appreciate the tip!
     
  16. BBrown4

    BBrown4

    Joined:
    Feb 13, 2013
    Posts:
    15
    This problem is still occurring in VS 2017 CE 15.4.4. @snacktime I couldn't seem to figure out your solution, however I was able to find a quicker workaround based off yours. @ScottAdams and anyone else having this issue, a quicker workaround to the issue is with the file open go to: File -> Move [filename] into > Assembly-CSharp and that should get you going again.
     
  17. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    This happens to me from time to time and both @snacktime's and @Baste 's solutions work for me. Thanks guys this was driving me insane! :D

    I'm on Unity 2017.2 and VS 15.4.2
     
  18. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    Ah, okay, what is fixing this for me, at least when this happens when I create a script file, is hitting the refresh button in the Solution Explorer pane.

    Both highlighting and intellisense stops working on new files, hitting refresh is solving this for me.
     
  19. Mikael-H

    Mikael-H

    Joined:
    Apr 26, 2013
    Posts:
    309
    I tried hitting the refresh button in the solution view but it didn't work for me. Maybe there are two different core issues here? Do you also get the file marked as "miscellaneous file"?
     
    Last edited: Dec 4, 2017
  20. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    Mikael-H likes this.
  21. SmartMediaNL

    SmartMediaNL

    Joined:
    Sep 29, 2016
    Posts:
    77
    For me it worked by moving the C# files without (intellisense working) out of the project folder and back again. (unity does a rebuild and then I can open the file in VS with intellisense working again or by creating a new file in Visual Studio it self rather then in Unity.
    It seems somehow the file type is mixed up when creating a new script file in Unity.
     
    Mikael-H likes this.
  22. Savage3DGames

    Savage3DGames

    Joined:
    Jul 26, 2017
    Posts:
    1
    I have the same issue. The simplest way to fix it is to hit "Refresh" button in Solution Explorer.
     
  23. myrobishow_unity

    myrobishow_unity

    Joined:
    Dec 5, 2017
    Posts:
    1
    @Baste Thank you very much, it worked fine for me!
     
  24. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    Ah, forgot to come back here to say that this not always solve my issue! The only solution for me the last time was @Baste's... Yes, I also get files marked as miscellaneous, the other scripts doesn't recognize objects from these files "not loaded".
    It's been a long time already, I wonder when MS will fix that! For me it started when I upgraded VS2017 at ~August...
     
    Mikael-H likes this.
  25. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    They seem to release patches every 2 weeks on the Monday, the last being the 27th. I'd expect 15.5 to drop on Monday. I've switched to the preview release which works fine, so I can confirm it is fixed.
     
    Rodolfo-Rubens and Mikael-H like this.
  26. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    I updated to 15.5.0 (stable, not preview) and now it stopped for good, intellisense doesn't work on all files now, I tried deleting the .csprojs and .slns then reopening the project through Unity - Assets - Open C# Project, hitting refresh but nothing fixed it.

    Also, there is something on all files that if I modify them and close them without save, the edits stays there (A red checkmark appears next to the file name in the solution explorer).

    Another thing is, I cannot un-assign Ctrl+W from the select word command (I use ctrl+W to close the current document), even if I change this in tools - options - keyboard, it stills use Ctrl+W to select the current word.

    F*ck VS, I'm going to use Rider, Mono or something else, even windows notepad is a better option at this point.
     
  27. SpreadcampShay

    SpreadcampShay

    Joined:
    Dec 9, 2010
    Posts:
    180
    Suffering the same since 15.5, Intellisense is completely broken it stays in "Miscellaneous Files" mode without Syntax Highlighting and Intellisense. "Visual Studio Code" works, but only if changing its useMono Setting to true. Tried reinstalling VS, .NET and so on to no avail. Interestingly, Solutions in a new fresh Project seems to work but that's no use to me with my large existing project.

    EDIT: Finally got it working again by installing the .NET desktop Development in the Visual Studio installer and all the .NET Targeting packs too
     
    Last edited: Dec 6, 2017
    barocon and DavidSmit like this.
  28. kai_226

    kai_226

    Joined:
    Jul 6, 2017
    Posts:
    53
    Hello guys,

    I am having the same problem but unfortunately, none of the solutions above worked in my case. Any other ideas?
    I'm getting a bit desperate here...

    EDIT: I was able to resolve it with this trick:
    Do me a favor... if this is Visual Studio 2017... hit your start menu and find Visual Studio Installer... Run it... select "Modify" and select individual components... find Visual Studio Tools for Unity... if it's installed, untick it and uninstall it, then run the installer again and reinstall it. Otherwise, just tick it and install it.
     
    Last edited: Dec 8, 2017
  29. DavidSmit

    DavidSmit

    Joined:
    Apr 1, 2014
    Posts:
    50
    I solved this through MS support.
    For me this solved it:
    Go to the Visual Studio installer. -> Modify VS. ->Individual components -> select, NuGet Package Manager (under code-tool)
    Hope it works!
     
  30. koivar

    koivar

    Joined:
    Aug 18, 2015
    Posts:
    1
    I just noticed that having a folder called "Standard Assets" with any .cs files in it breaks intellisense. It makes ProjectName.Plugins to appear in VS and intellisense "focuses" on that instead of your actual project and scripts. If you just rename the folder to anything else, it starts working properly again.
     
    RedAnger and kai_226 like this.
  31. VaBeach

    VaBeach

    Joined:
    Nov 10, 2014
    Posts:
    1
    You nailed it for me. I just took the space way between "Standard Assets". Now it just reads StandardAssets and everything works fine.
     
  32. aj1176

    aj1176

    Joined:
    Jan 26, 2017
    Posts:
    3
    Hi
    syntax in Visual Studio not work for any code like : "GameObject Debug.Log ... "
     
  33. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    thanks guys, i tried the solutions in this thread,

    -> I think updating my Visual Studio would have solved it on its own

    recap of what i did
    i tried Solution A of this thread:
    "You can force the solution to regenerate by deleting the .sln file in your assets folder and then open the solution from Unity again. Delete all of the .csproj files while you're at it."

    - Worked for intellisense, but .sln file would not regenerate. When i use "Assets>Open C# Project" i get "unity ArgumentException: Value does not fall within the expected range."
    - i had to Update Visual Studio, maybe then it would have worked directly

    Solution B of this thread
    "You may have to install .NET again: In Windows, Go to Control Panel / Programs and Features / (then on the left side) Turn window features on and off / and selecting both .NET 3.5 as well as .NET 4.6. You may then also have to reboot your computer after installing. This has worked for some users, let me know if it solves the problem!"
    - didn't try that
     
  34. AlexanderBAUTY

    AlexanderBAUTY

    Joined:
    Apr 9, 2018
    Posts:
    1
    This worked for me when all else failed, worth a first try for anyone having the issue.
     
  35. abhishek_srk

    abhishek_srk

    Joined:
    Jul 17, 2018
    Posts:
    1
    Sometimes it is shown "Miscellaneous Files" instead of the name of project and no auto completion working. It occurs due to many reasons but the effective solution is:
    >> Download and Install Visual Studio Tools for Unity
    >>.From Unity Editor go to Edit >> Preferences >>External Tools
    >> In the External Tools Select External Script Editor Drop-down and Select respective version of Visual Studio in place of Open By File Extension.
    Untitled.png
     
  36. ZaneViVi

    ZaneViVi

    Joined:
    May 28, 2019
    Posts:
    1
    This worked for me. I had to restore my OS and reinstall Unity and after that the Visual Studio intellisense stopped working. Baste's solution worked like a charm.
     
  37. Filaipus

    Filaipus

    Joined:
    Nov 27, 2013
    Posts:
    1
    Quoting this since it was what fixed my problem.